[WLUG] Help! AWS/EC2, interactive login, but sudo reports no tty error....

Robert Citek robert.citek at gmail.com
Thu Mar 22 19:49:36 EDT 2018


FWIW, I'm running an Ubuntu 16.04 EC2 instance and that command worked
as expected:

ubuntu at ip-10-33-3-240:~$ sudo -i
root at ip-10-33-3-240:~#

Now that you git it working, you could create a custom AMI from that instance.

Good luck and let us know how things go.

Regards,
- Robert

On Thu, Mar 22, 2018 at 3:06 PM, Mark J. Bobak <mark at bobak.net> wrote:
> Hi Charles,
>
> Thanks for the suggestions.
>
> I did try the 'ssh -t', but it didn't work.
>
> I ended up just shutting it down, mounting root device on another host and
> editing the /etc/sudoers from there.
>
> A bit of a pain, but it worked.
>
> Thanks again,
>
> -Mark
>
> On Thu, Mar 22, 2018 at 5:49 PM, Charles Ulrich <charles at bityard.net> wrote:
>>
>> 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
>>
>> ______________________________________________________
>> washlug mailing list    washlug web site
>> washlug at washlug.org     www.washlug.org
>> http://linux.marcdatabase.com/mailman/listinfo/washlug
>
>
>
> ______________________________________________________
> 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