Quantcast
Channel: Admins Goodies » nologin
Viewing all articles
Browse latest Browse all 5

Executing a command as a nologin user

$
0
0

Question

I’ve recently set up my server so that my suPHP ‘virtual’ users can’t be logged into by using this article

My issue now is that before when I ran a rake command for my Ruby on Rails application running on the server, I used su to go into www-data and execute the command from there – obviously I can’t do that anymore because of the nologin.

So as a root user, how can I execute commands as other user’s, even if they are nologin?

Answer

One way is to launch a shell for that user (explicitly specifying the shell):

sudo -u www-data bash 

This will launch a (bash) shell as the specified user. You can then execute your command(s) and logout (to return to your previous shell)


Viewing all articles
Browse latest Browse all 5

Trending Articles