Tiny Core Base > TCB Q&A Forum

[Solved] Autologin with sudo asking for password

(1/2) > >>

igor.kattar:
How can I autologin with a user that asks for sudo password?

I set the passwords for tc and root users, then changed sudoers with
--- Code: ---sudo visudo
--- End code ---

If in the /etc/sudoers file I have:

--- Code: ---root ALL=(ALL) ALL
tc ALL=(ALL) ALL
tc ALL=(ALL) NOPASSWD: /sbin/reboot,/sbin/poweroff,/sbin/halt

--- End code ---
I cannot autologin anymore (I have to supply the password multiple times)

If I have the standard:

--- Code: ---root ALL=(ALL) ALL
tc ALL=(ALL) NOPASSWD: ALL

--- End code ---
I can autologin.

In the /opt/.filetool.lst file I have

--- Code: ---opt
home
etc/shadow
etc/passwd
etc/sudoers

--- End code ---
every change I run
--- Code: ---sudo filetool.sh -b
--- End code ---
and since its a VM for tests, I have snapshots too.

It is a x86_64 machine with the 16.1 version of TinyCorePure64.

The goal is to make the image available via PXE to students but not allow them to install programs and interfere with the computers' disks (installing parted, mounting disks, etc).

Rich:
Hi igor.kattar
Welcome to the forum.

If I understand the issue, what happens if you add login and autologin to NOPASSWD:

--- Code: ---tc ALL=(ALL) NOPASSWD: /sbin/reboot,/sbin/poweroff,/sbin/halt,/sbin/autologin,/bin/login
--- End code ---

igor.kattar:
I still have to supply the password.

With the lines in /etc/sudoers:

--- Code: ---tc    ALL=(ALL) ALL
tc    ALL=(ALL) NOPASSWD: /sbin/reboot,/sbin/poweroff,/sbin/halt,/sbin/autologin,/bin/login
--- End code ---
After forcing the login, holding <enter>, the output of
--- Code: ---sudo ps auxw
--- End code ---
is (notice the 3766 and 3786 PIDs)

--- Code: ---...
  329 root     [kworker/R-ext4-]
 3090 root     /sbin/udevd --daemon
 3195 tc     -sh
 3213 root     /sbin/udhcpc -b -i eth0 -x hostname:box -p /var/run/udhcpc.eth0.pid
 3718 root     /usr/local/lib/xorg/Xorg -nolisten tcp
 3720 root     /sbin/udevd --daemon
 3724 tc     flwm_topside
 3746 tc     aterm
 3747 tc     sh
 3766 tc     {wbar.sh} /bin/sh /usr/local/bin/wbar.sh
 3786 root     sudo mv /tmp/work3766 /usr/local/tce.icons
 3788 tc     wbar
 3801 tc     aterm
 3802 tc     sh
 3829 tc     -sh
 3859 root     ps auxw

--- End code ---
With the line:

--- Code: ---tc   ALL=(ALL) NOPASSWD: ALL
--- End code ---
After the autologin the output of
--- Code: ---sudo ps auxw
--- End code ---
is

--- Code: ---...
  432 root     [kworker/1:2-mm_]
 3134 root     /sbin/udevd --daemon
 3135 root     /sbin/udevd --daemon
 3236 tc     -sh
 3412 root     /sbin/udhcpc -b -i eth0 -x hostname:box -p /var/run/udhcpc.eth0.pid
 3794 root     /usr/local/lib/xorg/Xorg -nolisten tcp
 3799 tc     flwm_topside
 3848 tc     wbar
 3862 tc     aterm
 3863 tc     sh
 3883 tc     -sh
 3913 root     ps auxw
--- End code ---

Rich:
Hi igor.kattar
Maybe add  /bin/mv  to the list?

Rich:
Hi igor.kattar
Another potential sudo issue:

--- Code: ---tc@E310:~$ grep sudo .profile
[ "`id -un`" = "`cat /etc/sysconfig/tcuser`" ] && echo "$BACKUP" | sudo tee /etc/sysconfig/backup >/dev/null 2>&1
--- End code ---
You might need to add  tee  to the list.

Navigation

[0] Message Index

[#] Next page

Go to full version