![]() ![]() You can grant or inhibit any access for a user or a group by changing the rules in that file. This file contains rules that controls user’s and groups authorities, you can also change and customize all the levels of permissions for a user or a group. If the output is the phrase in quotes, that means you are in sudo group now! Add the User to the Sudoers File Separately You can check if the previous command ran successfully by running any command as root. The flag a stands for append, and G stands for group, you need to change rootie by your targeted user’s name. Open-up a terminal window either graphically or by pressing t while holding both Alt and Shift keys.Įxecute the next command to add the user rootie to the sudo group (don’t forget to pass-in your password). You have to login as a user that has the authority to execute commands as root (the first user which is created when setting up your machine will have that authority by default). Members of this group can execute any command as root (and in turn as any other user in the system), so the process is fairly straight-forward. ![]() This way is the default in all Debian-based systems. ![]() Add the User to the Sudoers File Separately.rw-rw-r- 1 yourUserName www-data 7192 Oct 4 00:03 filename. rw-r-r- 1 yourUserName www-data 7192 Oct 4 00:03 filename.html The result should look something like: WAS: Recursively change group premissions of the folders and sub-folders to enable write permissions: find. Recursively change group ownership of the folder keeping your user ownership chown yourUserName:www-data -R yourWebSiteFolder/*Ĭhange directory to yourWebSiteFolder cd yourWebSiteFolder YourUserGroupName is usually similar to you user name You should get something like: yourUserName : yourUserGroupName www-data So that would be: sudo usermod -aG www-data yourUserNameĬheck your user is in www-data group: groups yourUserName If you want to see how apache web server is running, issue the command, ps aux | grep apache2 | lessįor those who have their wordpress root folder under their home folder:ĬREDIT Granting write permissions to www-data group On many (not all) distributions, WordPress uses the user www-data to write files. Since the created files will have world read permission, apache (or your web server) should not face any problem accessing them.Īlso, as pointed out by dan08 in comment, you need to add www-data to site1 group. Try to recreate the file (beware that you have been moved to the home directory of user1 after changing group), this should work now. This failed since most likely the primary group of user1 is not site1. Now login as user1, move to site1 directory and try to create a file in that directory, echo "My User1 Site" > index.html Any user belonging to group site1 will enjoy all the privileges granted to that group. Both user root and group site1 have write permission (plus read and execute permissions) to the directory. So, the directory now is owned by user root, group site1. Mode of `/var/www/site1/' changed from 0755 (rwxr-xr-x) to 0775 (rwxrwxr-x)Ĭheck that all the changes are indeed there, ls -ld /var/www/site1/ĭrwxrwxr-x 2 root site1 4096 Oct 24 21:06 /var/www/site1/ ![]() Grant write permission to this new group owner, sudo chmod -vR g+w /var/www/site1/ sudo chown -vR :site1 /var/www/site1/Ĭhanged ownership of `/var/www/site1/' from root:root to :site1 Now we can change the group ownership of your intended directory. The output should be a list something like, user1 : site1 We will give write permission to that particular group as well.Īdd user1 to the newly created group, sudo adduser user1 site1Ĭheck that user1 is really in that group, groups user1 We will want to change the group ownership to another (new) group and add user1 to that particular group. While user root has write permission (plus read and execute permissions) to the directory, group root has only read and execute permissions. This means that the directory is owned by user root, group root. If we check ownership of site1, we will find something like this, ls -ld /var/www/site1/ĭrwxr-xr-x 2 root root 4096 Oct 24 21:06 site1/ ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |