![]() |
|
|||||||
| FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
![]() |
|
|
Thread Tools | Display Modes |
|
|||
|
Is it possible when logged in as root to run command as user, bit like sudo in reverse?
cheers |
|
||||
|
The general syntax for a sudoers rule is:
user system = (run as) commands e.g.: carpman ALL = (operator) ALL Would allow you to execute any command as "operator" on any host with this rule in the sudoers file. Then you would: $ sudo -u operator <whatever> Disclaimer: I haven't run the rule through visudo to check it. You may need to adjust it.
__________________
OpenBSD LiveCDs/LiveDVDs |
|
||||
|
su(1) will work when logged in as root; otherwise the password for the "run as" user is required.
Using sudo, any user can be permitted to "run as" another, without needing that userid's password. In addition, one can "run as" another user that does not have a usable $HOME or login shell.
__________________
OpenBSD LiveCDs/LiveDVDs |
|
|||
|
Hello and thanks for replies.
the su method seemed to fail Code:
su - wwwuser -c touch /hsphere/local/home/wwwuser/test.txt The parent process is not sshd. Exiting... but sudo method worked for touch Code:
sudo -u wwwuser touch /hsphere/local/home/wwwuser/test.txt Did not work for script app.sh but think that maybe another issue i looking into. cheers |
|
||||
|
re: su
On OpenBSD, the -c option is for login class, not for command. See the su(1) man page. Here's an example of substituting the identity of a typical "nologin" userid: Code:
# su -m nobody ksh: Cannot determine current working directory $ touch /tmp/test $ exit # ls -l /tmp/test -rw-r--r-- 1 nobody wheel 0 Feb 18 13:05 /tmp/test
__________________
OpenBSD LiveCDs/LiveDVDs |
|
||||
|
Ooops. This is FreeBSD. Sorry. But -c is still login class.
See the FreeBSD version of su(1).
__________________
OpenBSD LiveCDs/LiveDVDs |
|
||||
|
Can you explain why the EXAMPLES don't match the SYNOPSIS in that man page?
One of them is wrong.
__________________
OpenBSD LiveCDs/LiveDVDs |
![]() |
| Thread Tools | |
| Display Modes | |
|
|