Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhrubel/d4c8d084a4307dd3737237f6aa2abe06 to your computer and use it in GitHub Desktop.
Save mhrubel/d4c8d084a4307dd3737237f6aa2abe06 to your computer and use it in GitHub Desktop.
There are three things to do to allow a 'service user' like www-data to login via ssh.
DISCLAIMER:
READ EVERYTHING BEFORE USE ANY COMMAND... OTHERWISE, YOU MIGHT LOSE ACCESS OF YOUR SERVER...
#Step 01
########################
#Use the below GIST and propely follow the command then come here and use below steps.
Link: https://gist.github.com/mhrubel/43825450cba521ede15d7b73cf865472
#Step 02
########################
# Set a password for www-data
sudo passwd www-data
#Step 03
########################
# Define a shell for www-data by editing /etc/passwd.
sudo nano /etc/passwd
# Replace
/usr/sbin/nologin or similar by /bin/bash
# on the line of all of the user. EX: root or any other user you want to use to login on your server...
Note: You might not be able to login with "root" or any other user,
# if you do not add /bin/bash for all of the user, you wish to use for login...
### Lets Restart the SSHD service
sudo systemctl restart sshd
# OR
sudo service sshd restart
NOTE: This guide should work with almost all Ubuntu and Debian based OS versions...
DISCLAIMER: I'm not responsible if you brake anything from the server using this guide! Use this guide at YOUR OWN RISK...
@mhrubel
Copy link
Author

mhrubel commented Nov 9, 2019

This solution most probably works in all of the versions of Ubuntu and Debian OS. But, I only used it with the Ubuntu 18.04 version...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment