sudo: sorry, you must have a tty to run sudo | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

sudo: sorry, you must have a tty to run sudo

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-27-2012
Apple1221 Apple1221 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 31 July 2012, 3:34 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
sudo: sorry, you must have a tty to run sudo

Hi All,

I running a unix command using sudo option inside shell script. Its working well. But in crontab the same command is not working and its throwing
"sudo: sorry, you must have a tty to run sudo". I do not have root permission to add or change settings for my userid. I can not even ask sysadmin to do something for my userid. Is there work around or alternative to run the command sucessfully in crontab.
Sponsored Links
    #2  
Old 07-27-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 27 July 2014, 8:53 PM EDT
Location: NM
Posts: 10,155
Thanks: 269
Thanked 781 Times in 731 Posts
Is this Fedora? Anyway, the ONLY fix is:

Code:
visudo /etc/sudoers
comment out: #Default requiretty

And you have to have privilege. Can we know why no sysadmin is available?
If this is a production job, surely SOMEBODY will want to get it running.
Sponsored Links
    #3  
Old 07-27-2012
chidori chidori is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 3 December 2013, 12:16 PM EST
Posts: 215
Thanks: 51
Thanked 3 Times in 3 Posts
infact i have the same issue in my fedora 17 box!!

i tried commenting out requiretty in sudoers but after that i am getting this error


Code:
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts

    #4  
Old 07-27-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 27 July 2014, 10:58 PM EDT
Location: Saskatchewan
Posts: 18,978
Thanks: 748
Thanked 3,146 Times in 2,951 Posts
It means what it says. It wants to ask for a password and can't, because it has no terminal.
Sponsored Links
    #5  
Old 07-27-2012
chidori chidori is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 3 December 2013, 12:16 PM EST
Posts: 215
Thanks: 51
Thanked 3 Times in 3 Posts
i know that ssh -t is a work around. just wanted to know some other way and tried bit of googling and got an update that commenting out requiretty from sudoers file will also fix the issue but it aint work.

any suggestions please
Sponsored Links
    #6  
Old 07-27-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 27 July 2014, 10:58 PM EDT
Location: Saskatchewan
Posts: 18,978
Thanks: 748
Thanked 3,146 Times in 2,951 Posts
Show your code, please. We've reached the limit of what we can do for you without seeing what you're actually trying to do.
Sponsored Links
    #7  
Old 07-28-2012
Apple1221 Apple1221 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 31 July 2012, 3:34 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry for the late reply,

Atcually, I have an user account in unix(RHEL) and from where I connect to other unix servers using ssh to do my work in that server. I have a script which connect to other servers and get the file from the server. example: kscp <server_name > <file location>. It connects to the respective server and get the file to the location destination of calling server. This script is provided by some other team, long ago. I do not have access to change the script. I am using that script(kcp) in my shell and fectching the file.(Its working good). Now if schedule my script in cron. Its not working.

Thanks.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ssh foo.com sudo command - Prompts for sudo password as visible text. Help? fluoborate Shell Programming and Scripting 9 11-02-2011 02:18 PM
sudo log and sudo auditing jalite19 AIX 3 12-08-2010 04:11 PM
Unable to use the Sudo command. "0509-130 Symbol resolution failed for sudo because:" Chloe123 UNIX for Dummies Questions & Answers 1 12-21-2009 04:09 PM
sudo sydney2008 UNIX for Dummies Questions & Answers 3 08-25-2008 01:34 AM



All times are GMT -4. The time now is 12:12 AM.