Last active
October 5, 2016 06:03
-
-
Save cookie-ag/f880799d460a658e75c371ea17a23a50 to your computer and use it in GitHub Desktop.
Creating a safe user in Ubuntu 16.04
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
// If the application has a error it can bring down the complete server as it has credentials to do so. | |
// To prevent this : Create a new user in /home/safeuser/ | |
- if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi (Check if you are root) | |
- sudo -i (change to root) | |
- cut -d: -f1 /etc/passwd (To list all local users) | |
- useradd -s /bin/bash -m -d /home/safeuser -c "safe user" safeuser :(Create only as root) | |
- passwd safeuser : (Add a password) | |
- usermod -aG sudo safeuser :(Give safeuser permission to use root level commands) | |
- Login as safeUser : ssh safeuser@IP | |
- chmod 0444 /path/to/folder (Give any folder read-only access, such as SSL folder) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment