Last active
February 5, 2018 15:13
-
-
Save aonurdemir/10f289314152166238614d5232cc627d to your computer and use it in GitHub Desktop.
OS user creation
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
Create a user for your app, named hello and assigned to a system group called webapps. | |
$ sudo groupadd --system webapps | |
$ sudo useradd --system --gid webapps --shell /bin/bash --home /webapps/hello_django hello | |
I like to keep all my web apps in the /webapps/ directory. If you prefer /var/www/, /srv/ or something else, use that instead. | |
Create a directory to store your application in /webapps/hello_django/ and change the owner of that directory to your | |
application user hello | |
$ sudo mkdir -p /webapps/hello_django/ | |
$ sudo chown hello /webapps/hello_django/ | |
$ sudo su - hello (gerek yok sadece kullanıcı hesabı değiştirmeye yarıyor) | |
Allowing other users write access to the application directory | |
Your application will run as the user hello, who owns the entire application directory. If you want regular user to | |
be able to change application files, you can set the group owner of the directory to users and give the group write | |
permissions. | |
$ sudo chown -R hello:users /webapps/hello_django | |
$ sudo chmod -R g+w /webapps/hello_django | |
You can check what groups you’re a member of by issuing the groups command or id. | |
$ id | |
uid=1000(michal) gid=1000(michal) groups=1000(michal),27(sudo),100(users) | |
If you’re not a member of users, you can add yourself to the group with this command: | |
$ sudo usermod -a -G users `whoami` | |
Group memberships are assigned during login, so you may need to log out and back in again for the system to | |
recognize your new group. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment