Last active
August 7, 2024 08:08
-
-
Save mhrubel/d4c8d084a4307dd3737237f6aa2abe06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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...