Steps to create “protected” user account in linux


Steps to create user account
----------------------------
1. # useradd [USERNAME] -d /home/sftponly/[USERNAME]/ -s /bin/false -G sftponly

2. set passwrd
# passwd [USERNAME]

3. change owner to root and chmod 755
# cd /home/sftponly
# chown root:root [USERNAME]
# chmod 755

4. Create folder in /var/www/html & link inside folder
e.g:
# mkdir /var/www/html/kosong.com.my
# chown apache:[USERNAME] /var/www/html/kosong.com.my
# mkdir /home/sftponly/[USERNAME]/kosong.com.my

5. Add mount bind in /opt/runbind.sh
# vim /opt/runbind.sh
add :-
mount –bind /var/www/html/kosong.com.my/home/sftponly/[USERNAME]/kosong.com.my
save.
run script:
# /opt/runbind.sh

p/s: tested on CentOS 6

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s