2

I've created my user like this:
sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "Deluge server" --group deluge

The content of /etc/passwd:
deluge:x:110:114:Deluge server,,,:/var/lib/deluge:/bin/false

The directory I'm in :

root@xxxxxx:/var/lib/deluge/.flexget# ls -al  
drwxr-xr-x 2 deluge deluge 4096 15 mars  11:39 .  
drwxr-xr-x 7 deluge deluge 4096 15 mars  11:40 ..  
-rwxr-xr-x 1 deluge deluge 3881 15 mars  11:39 config.yml

What I'm trying to do :

su deluge -c "flexget --test execute"

But nothing happens, I've got no error shown, I also tried just su deluge but the same still root. How can I run a command using this user ? (I'm not using sudo)

Pontek
  • 23

1 Answers1

3

Your deluge user has /bin/false for their default shell - this is what su is running and passing the -c option to (or running without any options when you simply do su deluge). You can use the --shell option to adduser to set a shell when creating the user. Eg:

sudo adduser --shell /bin/sh --disabled-password --system \
  --home /var/lib/deluge --gecos "Deluge server" --group deluge

Or use chsh to change the shell for an already created user:

sudo chsh -s /bin/sh deluge

Or you could use the --shell (or -s) option with su to override /etc/passwd:

su deluge -s /bin/sh -c "flexget --test execute"

Depending on what else your are doing with the user, /bin/bash might be a more appropriate shell to use.

Graeme
  • 34,027