useradd -m THEUSERNAME
You can then set the password with:
passwd
THEUSERNAME
You can disable logins to the account by setting the shell to /sbin/nologin
usermod -s /sbin/nologin THEUSERNAME
Enable usedir.conf of apache.
1
| nano /etc/httpd/conf .d /userdir .conf |
Change from:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| <IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # UserDir disabled # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # UserDir public_html < /IfModule > <Directory /home/ * /public_html > Options Indexes Includes FollowSymLinks Require all granted < /Directory > |
To:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| <IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # #UserDir disabled # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # UserDir public_html < /IfModule > <Directory /home/ * /public_html > Options Indexes Includes FollowSymLinks Require all granted < /Directory > |
Then restart apache…
1
| systemctl restart httpd.service |
Create user’s public_html and assign permissions.
Then here’s the other new things, especially you are using SELinux
2
|
setsebool -P httpd_enable_homedirs true
chcon -R -t httpd_sys_content_t /home/THEUSERNAME/public_html
|
Create an index.html file
/home/THEUSERNAME/public_html/index.html
Change ownership
1
|
chmod 644 /home/THEUSERNAME/public_html/index.html
|
Run the test by navigating to the following URL from your browser.
1
|
http://YOUR-VPS-IP/~THEUSERNAME
|
0 comments:
Post a Comment