![]() ![]() Let's create the new user's home directory under /ftp with the -d parameter: ~]$ sudo adduser faruk -d /ftp/faruk Next, let's define the permissions: home]$ sudo chmod 770 -R /ftp home]$ sudo chown -R faruk:ftp /ftp/faruk Create new FTP Userįirst of all, let's explain the steps to be considered when creating a new user. Let's create a directory in the /(root) directory for the ftp user home directory: ~]$ sudo mkdir /ftp In this step, let's define a different directory for the root directory and give the home directory different from the standard when creating a new user. The operation is successful so we have successfully restricted user to a directory using FTP.ĪLSO READ: Tutorial: Encrypt, Decrypt, Sign a file with GPG Public Key in Linux Example-2: Define a different root directory for each user Let's go to the user's home directory: ftp> cd ftpuserĢ27 Entering Passive Mode (192,168,122,15,121,25). Let's try to change to a different directory: ftp> cd /etc It has not moved to the parent directory, we are still under /home. Let's try to change to the parent directory: ftp> cd. We can see that it lists the users under the /home directory. This step is completed with the two lines we added to nf. Sep 09 15:41:17 almalinux8 systemd: Started Vsftpd ftp daemon. Sep 09 15:41:17 almalinux8 systemd: Starting Vsftpd ftp daemon. Process: 1667 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/nf (code=exited, status=0/SUCCESS) ![]() Loaded: loaded (/usr/lib/systemd/system/rvice enabled vendor preset: disabled)Īctive: active (running) since Fri 15:41:17 +03 19s ago Let's take a look at the service status: ~]$ systemctl status rvice Then the vsftpd service is ~]$ systemctl restart rvice 18 foc foc 4096 Sep 9 15:41 focĭrwx- 3 ftpuser ftpuser 109 Sep 8 23:10 ftpuserĪs seen above, each user's home directory is set to be accessible only to him. If you have a different authorization, set it to allow only the user's home directory to be accessed with the following command: home]$ sudo chmod -R 700 /home/ftpuser The only thing you need to pay attention to is the user home directory privileges: home]$ ls -laĭr-xr-xr-x. If you want to continue in this way, simply follow the steps above. When a user is created in Linux, the home directory is automatically created under /home. In other words, when the user logs in, they will have access to their own directories under /home, and moving to the upper directory will be restricted. Here, users' /home directory is set to /(root) directory. Open this file with an editor (vi, nano etc) and add the following lines (or modify existing entries if already present): chroot_local_user=YES The example nf file is as follows: opt]$ cat /etc/vsftpd/nf When this package is installed, the configuration information is written to /etc/vsftpd/nf. The ftp server package of Linux operating systems (Redhat, Centos, Debian, Ubuntu etc) is vsftpd.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |