I need to allow user martin
to switch to user martin-test
without password
su - martin-test
I think this can be configured in /etc/pam.d/su
. There are already some lines in that file which can be uncommented. However, I don't like the idea of adding user martin
to group wheel
. I don't want to give martin
any more privileges than to be able to switch to martin-test
. I also do not want to use sudo
.
What would be the best way to do it, while keeping the privileges of user martin
minimal?
sudo
egsudo -u martin-test -i
. Is there a reason you are asking specifically aboutsu
?sudo
just because of this (I don't normally usesudo
and I don't particularly like it). And I think usingpam
is cleaner and more transparent way to do it.sudo
was meant for. Aside from not normally using it, what are the objections?pam
, I would prefer that oversudo
. Ifsudo
is the only possibility, than that is fine as well. My objections tosudo
are mostly ideological: I don't like the idea of user doing administration withsudo foo
. When I need to do administration, I log in as root. Otherwise I log in as user, These two distinct roles should not be mixed. Also, I already havepam
infrastructure installed. I don't want to install anothersetuid
program which can possibly introduce security bugs.sudo foo
for specific commands. Sudo hassudo -s
which will launch a shell. sudo is a very common utility meaning it's security has been thoroughly vetted, far more than some pam trickery will be. I would also argue that getting a root shell for tasks is much more insecure than launching specific commands. When you launch a shell, you run everything as root. If any one of those things (such as a simplels
) has a security vulnerability, then you've just opened a security hole.