Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section General Discussion
  • Search

sudo: no tty present and no askpass program specified

General questions about VestaCP
Post Reply
  • Print view
Advanced search
10 posts • Page 1 of 1
missionaryman
Posts: 50
Joined: Mon Oct 27, 2014 10:04 am

sudo: no tty present and no askpass program specified
  • Quote

Post by missionaryman » Mon Oct 01, 2018 2:35 am

Hi All,

Ubuntu 16.04.5 running VestaCP 0.9.8-22

I'm using a script to copy a backup file to dropbox. The script is stored in /usr/local/bin, has 0755 permissions and is owned by admin:admin.

Running the script from the command line works perfectly.

Setting it as a CRON job generates the following error:

sudo: no tty present and no askpass program specified

Any ideas how to fix this?

Thanks,
Adam
Top

ScIT
Support team
Posts: 617
Joined: Mon Feb 23, 2015 4:13 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by ScIT » Mon Oct 01, 2018 3:50 am

not really vesta related, you will find a solution using google or take a look here: https://stackoverflow.com/questions/216 ... fied-error
Top

missionaryman
Posts: 50
Joined: Mon Oct 27, 2014 10:04 am

Re: sudo: no tty present and no askpass program specified
  • Quote

Post by missionaryman » Tue Oct 02, 2018 1:15 am

I've used Google, extensively, to find a solution, to no avail.

The link you posted is not relevant to my situation. There are more relevant, VestaCP-related posts that ask similar questions, with a variety of answers, none of which work for me.

Anyone else?
Top

ScIT
Support team
Posts: 617
Joined: Mon Feb 23, 2015 4:13 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by ScIT » Tue Oct 02, 2018 8:07 am

missionaryman wrote: ↑
Tue Oct 02, 2018 1:15 am
I've used Google, extensively, to find a solution, to no avail.

The link you posted is not relevant to my situation. There are more relevant, VestaCP-related posts that ask similar questions, with a variety of answers, none of which work for me.

Anyone else?
The problem is, that the cron needs sudo permission and want to ask for the password. The link I've sent to you is exactly about this issue - maybe you can search a sys admin that can help you out at your issue.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by mehargags » Wed Oct 03, 2018 6:15 am

in your /etc/hosts put your hostname in front of 127.0.0.1
Top

ralbrightii
Posts: 11
Joined: Sat Nov 23, 2019 1:37 am

Os: Ubuntu 17x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by ralbrightii » Sat Nov 23, 2019 1:42 am

I know this is slightly old, but it is still relevant. I have an install of VestaCP running on Ubuntu 18.04 LTS.

How exactly do I clear this up?

I have added the host names to 127.0.0.1 in the hosts file but editing the visudo I am still sketchy on. I have only had VestaCP loaded for a week, so I am sure these commands will get longer, but I am seeing emails for the following:
sudo /usr/local/vesta/vin/v-update-sys-queue backup
sudo /usr/local/vesta/vin/v-update-sys-rrd
sudo /usr/local/vesta/vin/v-update-sys-vesta-all

All of these are coming from the Cron Daemon.
Top

elamigosam21
Posts: 23
Joined: Mon Nov 21, 2016 5:47 am

Os: CentOS 6x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by elamigosam21 » Fri Dec 20, 2019 11:57 pm

I have recently started to get them too,
getting email from cron:
v-update-sys-rrd
v-update-sys-queue backup

also those scripts are listed under cron under a non admin user.
maybe I should remove them from that user since they are already listed in the user admin cron?

thanks
Top

menriquez
Posts: 9
Joined: Wed Nov 04, 2015 1:05 pm

Re: sudo: no tty present and no askpass program specified
  • Quote

Post by menriquez » Sun Mar 08, 2020 9:55 pm

ok...since no one has solved this issue here ill go ahead and post the solutions.. ScIT had it right actually you just had to read what the StackOverflow article was saying.

so I have a CRON script that needs root at

Code: Select all

/home/admin/web/lasvegasluxerealty.com/public_html/rets
called

Code: Select all

do_full_rets_update
so the problem is that VESTA runs CRON under the admin user, so what should it do to run a root script since admin has never logged in?

the answer is in visudo...specifically run

Code: Select all

sudo visudo 
at the end, use the template

Code: Select all

username ALL = NOPASSWD: /fullpath/to/command
so in this case...

Code: Select all

admin ALL=NOPASSWD: /home/admin/web/lasvegasluxerealty.com/public_html/rets/do_full_rets_update
save the file with <esc>:w! and you should be GTG.
Top

Szektor
Posts: 7
Joined: Sun Feb 02, 2020 1:49 pm

Os: Ubuntu 17x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by Szektor » Mon Apr 06, 2020 3:13 pm

In my case removing "sudo" from cron command helped.
These commands usually run with admin /root privileges so no need for sudo.

This article is useful as well:
https://askubuntu.com/questions/590339/ ... -my-server

Contains:
How to find cron user?

Code: Select all

sudo grep -R "/usr/local/vesta/bin/v-update-sys-queue backup" /etc/cron* /var/spool/cron/crontabs
Silence a command like this (temporary solution to not get spammed by cron):

Code: Select all

*/5 * * * * sudo /usr/local/vesta/bin/v-update-sys-queue backup > /dev/null 2>&1
Top

elamigosam21
Posts: 23
Joined: Mon Nov 21, 2016 5:47 am

Os: CentOS 6x
Web: apache + nginx
Re: sudo: no tty present and no askpass program specified
  • Quote

Post by elamigosam21 » Thu Sep 10, 2020 5:01 pm

Maybe this helps someone,
I have several servers with vesta, from some I get this error, from others I dont,
what I discovered,
is that the servers that I dont get the error from, dont have those cron jobs listed, only sudo user (admin) have the cron job.
the servers that give this error are servers that have the cron job on users that dont have sudo permissions,

I think this happens when I import a admin account on a new server as a new non-admin user,
then the admin account cron jobs get imported, but since the user is not an admin the error gets generated.
Top


Post Reply
  • Print view

10 posts • Page 1 of 1

Return to “General Discussion”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password