WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: sudoers - remove entry for user "tc"  (Read 5741 times)

Offline Alatun

  • Newbie
  • *
  • Posts: 41
sudoers - remove entry for user "tc"
« on: September 02, 2015, 08:51:54 AM »
To bring some security to my rdesktop system I added a password for root and removed the line for user "tc" from the sudoers file.
tc has no password and if it is present in the sudoers file a root password won't bring any security.

But this causes problems:
When user tc is being logged in automatically, a password prompt appears. -> .profile script uses sudo and relies that current user is in sudoers with option NOPASSWD. Looks like a bit strange to me.

When I hit enter (tc has no password) -> "segmentation fault". Seems the version of sudo in busybox has a serious issue here.

Currently I only see that "tee" is being used with sudo. Does anybody know, if other commands are being used with sudo during the startup process?


Offline Alatun

  • Newbie
  • *
  • Posts: 41
Re: sudoers - remove entry for user "tc"
« Reply #1 on: September 02, 2015, 12:00:20 PM »
I did some trial and error to restrict the rights of user "tc" in the sudoers file.

But this causes a lot of strange problems. The worst problem in my case: the system does no longer start the X server. The reason for this could be, that the extensions are no longer loaded. (I don't see any mounts to sqashfs).

I tried this as a config line in sudoers:
Code: [Select]
tc     ALL = NOPASSWD: /usr/bin/tee, /usr/mount, /sbin/poweroff, /sbin/reboot

poweroff, reboot are required for "exittc". tee is used by the ".profile" script. mount was a guess, because the sqash mounts are missing now.

This leaves me in an uncomfortable situation: I cannot restrict rights for user "tc" in sudoers and cannot ensure that users cannot get to the linux console.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: sudoers - remove entry for user "tc"
« Reply #2 on: September 02, 2015, 12:38:10 PM »
To prevent an escape to the shell,
add 2 lines to tc's .profile so that at the end it reads:

TERMTYPE=`/usr/bin/tty`
while true ; do
[ ${TERMTYPE:5:3} == "tty" ] && (
[ ! -f /etc/sysconfig/Xserver ] ||
[ -f /etc/sysconfig/text ] ||
[ -e /tmp/.X11-unix/X0 ] ||
startx
)
done

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11040
Re: sudoers - remove entry for user "tc"
« Reply #3 on: September 03, 2015, 04:09:10 AM »
There is no complete list, but a recursive grep should give an answer.

If you don't mean to load extensions or do other system tasks after boot, how about leaving tc with normal sudo access (but with a password), and using a different user for the autologin?
The only barriers that can stop you are the ones you create yourself.

Offline Alatun

  • Newbie
  • *
  • Posts: 41
Re: sudoers - remove entry for user "tc"
« Reply #4 on: September 03, 2015, 06:06:43 AM »
Again thanks for your proposals.

I will try what I can do until our system goes live.

Offline Zendrael

  • Sr. Member
  • ****
  • Posts: 363
    • Zendrael's home of projects
Re: sudoers - remove entry for user "tc"
« Reply #5 on: September 03, 2015, 02:06:06 PM »
Hi Curaga!

Which problems can occour if a new user is created (with the same .profile as tc) and user tc is completely removed?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: sudoers - remove entry for user "tc"
« Reply #6 on: September 03, 2015, 02:46:37 PM »
What would that accomplish?

Offline Zendrael

  • Sr. Member
  • ****
  • Posts: 363
    • Zendrael's home of projects
Re: sudoers - remove entry for user "tc"
« Reply #7 on: September 03, 2015, 02:52:00 PM »
That's the question! Will it bring any kind of problems to the system?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Re: sudoers - remove entry for user "tc"
« Reply #8 on: September 03, 2015, 03:13:35 PM »
Hi Zendrael
Actually, I believe gerald_clark ask you the opposite question, i.e. what do you think you will gain by doing that?

Offline Zendrael

  • Sr. Member
  • ****
  • Posts: 363
    • Zendrael's home of projects
Re: sudoers - remove entry for user "tc"
« Reply #9 on: September 03, 2015, 03:22:58 PM »
Hi Rich!

I was thinking on the side of this post, by removing tc from sudoers and removing the user from the system.

With a new user, not part of the sudores, but with same .profile, it will be able to start X and do all the stuff that tc does (minus the stuff which require sudo)?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: sudoers - remove entry for user "tc"
« Reply #10 on: September 03, 2015, 03:55:35 PM »
tc is just the default user.
the USER= boot code just changes the name of the user.  Everything works the same.

Changing the name of the user ( or using another user with same configuration as tc ) really accomplishes nothing since the user is normally autologin.
If you don't want autologin, use the noautologin boot code.
If you don't want sudo privileges for tc, rewrite /etc/sudoers in bootlocal.sh.

Offline Zendrael

  • Sr. Member
  • ****
  • Posts: 363
    • Zendrael's home of projects
Re: sudoers - remove entry for user "tc"
« Reply #11 on: September 03, 2015, 04:01:08 PM »
Ok Mr. Gerald_Clark!

Thanks!