Home / Community / Blog / Run command as user who cannot login

Run command as user who cannot login

Sometimes you have to run command as user who cannot login (shell set to /bin/false, /usr/sbin/nologin or something like this) in example for testing BackupPC where backuppc user usually cannot login but you have to run ssh command manually for the first time to add host to known_hosts.

Instead of ugly copping known_host file you can run:

sudo -u backuppc /usr/bin/ssh -l username remotehost

I think it's nicer way.

Comments

Log in or create a user account to comment.

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31