Solved Jail: run program as other user then root

pantos

New Member


Messages: 10

Hello,

I have a question of understanding. If I jexec a jail from my host I'm logged in as root. Is there a command (equal to sudo) to run a command as other user (e.g. www)? At the moment I'm changing the user first ( su www). Is there another way?

Thanks!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,091
Messages: 29,261

Another way is to use the -U option:
Code:
     -U username
             The user name from jailed environment as whom the command should
             run.
From jexec(8).
 
OP
OP
P

pantos

New Member


Messages: 10

Another way is to use the -U option [...] from jexec(8).
Thanks. I never used jexec() like this before . For executing a command from outside the jail as user www I now use: sudo jexec -U www jailname command

From inside the jail (similar to sudo) I use: su -m www -c 'command'

You make my day!
 
Top