1. How to add new users?
$ sudo vi /etc/group
and find line with
users:x:100:xxx,yyy,zzz
and add new username behind.
* for an independent system (unlike ours which is a virtual server attached to the main cluster), you may want to use useradd <username> to add new users. See detail here.
2. How to Enable Userdir (Public_html)?
$ sudo vi /etc/httpd/conf/httpd.conf
and find the following part and
<IfModule mod_userdir.c>
#UserDir disabled
UserDir enabled xxx yyy zzz
UserDir public_html
</IfModule>
$ sudo /etc/rc.d/init.d/httpd restart
Now you should be able to see the file content:
http://yourdomain.name/~xxx
If you got a 403 error, you should change the folder/file permission to 0755 and 0644, respectively.
If you got a 403 error, you should change the folder/file permission to 0755 and 0644, respectively.
3. How to change permission to a folder and all of its subfolders and files?
To set the directories to 755 and set the files to 644, you can use the
find
command. For example:
To change all the directories to 755 (-rwxr-xr-x):
find ~/public_html/myfolder
-type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find ~/public_html/myfolder -type f -exec chmod 644 {} \;
Ref: http://stackoverflow.com/questions/3740152/how-to-set-chmod-for-a-folder-and-all-of-its-subfolders-and-files-in-linux-ubunt4. How to set password for Userdir (Public_html)?
<Directory /home/xxx/public_html> AllowOverride All </Directory>
<Directory /home/xxx/public_html> AllowOverride AuthConfig </Directory>
AuthName "Add your login message here." AuthType Basic AuthUserFile /home/xxx/public_html/.htpasswd AuthGroupFile /dev/null require user name-of-user
Create (or clobber if it already exists) the password file /home/xxx/public_html/.htpasswd using the program htpasswd:
htpasswd -c .htpasswd name-of-user
Add a new user to the existing password file:
htpasswd .htpasswd name-of-user
Password file protection, ownership attributes:
File privileges: chmod ug+rw .htpasswd
File ownership: chown apache.apache .htpasswd
More method on encrypting a site can be found here: http://www.yolinux.com/TUTORIALS/LinuxTutorialApacheAddingLoginSiteProtection.html
Updating...
htpasswd .htpasswd name-of-user
Password file protection, ownership attributes:
File privileges: chmod ug+rw .htpasswd
File ownership: chown apache.apache .htpasswd
More method on encrypting a site can be found here: http://www.yolinux.com/TUTORIALS/LinuxTutorialApacheAddingLoginSiteProtection.html
Updating...
No comments:
Post a Comment