[WLUG] Help! AWS/EC2, interactive login, but sudo reports no tty error....
Charles Ulrich
charles at bityard.net
Thu Mar 22 17:49:22 EDT 2018
When logging in, try "ssh -t <user at host>", this forces pseudo-tty
allocation. Although I don't think this will help since it seems you do
already have a tty and sudo just doesn't see it. Still worth trying,
though.
After logging in, you could try "bash -l" to make sure you get a real
login shell and then try sudo from that.
In a Red Hat bug, a user posted this attachement
(https://bugzilla.redhat.com/attachment.cgi?id=1305084) which is a shell
script that wraps the call to sudo around the "script" program,
effectively faking a tty. Perhaps this technique can be used to edit
your /etc/sudoers file to remove the requiretty option.
Thanks,
Charles
On 2018-03-22 15:54, Mark J. Bobak wrote:
> Hi all,
>
> Can anyone help me with this?
>
> I'm running in AWS on EC2, and I'm getting this error:
>
> [ec2-user at ppbaudi-uat-web ~]$ cat /etc/oracle-release
> Oracle Linux Server release 6.7
> [ec2-user at ppbaudi-uat-web ~]$ tty
> /dev/pts/0
> [ec2-user at ppbaudi-uat-web ~]$ ls -l `tty`
> crw--w---- 1 ec2-user tty 136, 0 Mar 22 15:39 /dev/pts/0
> [ec2-user at ppbaudi-uat-web ~]$ id
> uid=500(ec2-user) gid=500(ec2-user) groups=500(ec2-user)
> [ec2-user at ppbaudi-uat-web ~]$ sudo -i
> sudo: sorry, you must have a tty to run sudo
>
> Clearly, I *do* have a tty, and this is an interactive session, but
> sudo thinks I don't have a tty.
>
> Yes, I know that I can edit /etc/sudoers and change to '!requiretty',
> except that I can't cause I need to sudo to be able to edit
> /etc/sudoers!
>
> This is AWS, so booting into single user mode to edit /etc/sudoers is
> not an option.
>
> I guess I could shutdown, mount root device on another server, and
> edit /etc/sudoers, but I'd really like to understand root cause, and
> I'd prefer to avoid the hassle of unmounting/remounting the root
> device....
>
> Help?
> -Mark
> ______________________________________________________
> washlug mailing list washlug web site
> washlug at washlug.org www.washlug.org
> http://linux.marcdatabase.com/mailman/listinfo/washlug
More information about the washlug
mailing list