Linux User & File Management
From 2047Servers Support
| Line 75: | Line 75: | ||
nano /etc/ftpusers | nano /etc/ftpusers | ||
| + | |||
=== Jailing Users in a folder === | === Jailing Users in a folder === | ||
| Line 81: | Line 82: | ||
You will have to edit your "proftpd.conf" file (or the vsftpd.conf file if you are using vsftpd instead) within that file you will see an option for default login root folder (If it is hashed out "#" unhash it & set it as "DefaultRoot ~" | You will have to edit your "proftpd.conf" file (or the vsftpd.conf file if you are using vsftpd instead) within that file you will see an option for default login root folder (If it is hashed out "#" unhash it & set it as "DefaultRoot ~" | ||
| + | |||
| + | Command to add a new user "testftp" & create a home / login folder in "/home/testftp" | ||
| + | |||
| + | <pre>useradd -m -d /home/testftp testftp</pre> | ||
| + | |||
| + | Set the password for the user | ||
| + | |||
| + | <pre>passwd testftp</pre> | ||
| + | |||
| + | ===SSH Lockout=== | ||
| + | |||
| + | <pre>nano /etc/passwd</pre> | ||
| + | |||
| + | Edit this file, find at the bottom their user name | ||
| + | |||
| + | You will see something like | ||
| + | |||
| + | <pre>testftp:x:1001:1001::/home/testftp:/bin/sh</pre> | ||
| + | |||
| + | name:x:userid:groupid::login/folder:/ssh settings (bin/sh = SSH Access, change this to /bin/false to prevent SSH login for this user) | ||
| + | |||
| + | You can also change the login/folder to where you want (as long as they have permissions to get into that folder it will work) | ||
| + | |||
Now if you have already created your user great, if not see the steps above on creating a user (useradd username), Once you have created a user edit the "/etc/passwd" file & edit the home directory to the folder location you want e.g. /home/newuser (Make sure that user has permission on that folder, otherwise they wont be able to login (because they dont have access to that folder) | Now if you have already created your user great, if not see the steps above on creating a user (useradd username), Once you have created a user edit the "/etc/passwd" file & edit the home directory to the folder location you want e.g. /home/newuser (Make sure that user has permission on that folder, otherwise they wont be able to login (because they dont have access to that folder) | ||
| Line 91: | Line 115: | ||
| − | + | === Folders & Group Access === | |
As you see in the screenshot above, there are two permission types you can set on each file/folder, You can give groups access to folders you want e.g. a "TF2_Server" you want your "TF2Admins" to have access to, all you would do is create a group & add the users you want to be in that group to it. | As you see in the screenshot above, there are two permission types you can set on each file/folder, You can give groups access to folders you want e.g. a "TF2_Server" you want your "TF2Admins" to have access to, all you would do is create a group & add the users you want to be in that group to it. | ||
| Line 104: | Line 128: | ||
usermod -a -G TF2Admins newuser | usermod -a -G TF2Admins newuser | ||
| + | |||
| + | ===FTP Permission Numbers Explained=== | ||
| + | |||
| + | 1st Number = Owner Access | ||
| + | |||
| + | 2nd Number = Group Access | ||
| + | |||
| + | 3rd Number = Public Access | ||
| + | |||
| + | |||
| + | 0 No Permissions - The User(s) can't do anything | ||
| + | |||
| + | 1 Execute Only - The User(s) can only execute the file) | ||
| + | |||
| + | 2 Write Only - The User(s) can only write to the file / folder) | ||
| + | |||
| + | 3 Write and Execute Permissions - The User(s) can only Write & Execute the file) | ||
| + | |||
| + | 4 Read Only - The User(s) can only read from the file / folder | ||
| + | |||
| + | 5 Read and Execute Permissions - The User(s) can only read from the file / folder & execute the file | ||
| + | |||
| + | 6 Read and Write Permissions - The User(s) can only read & write to the file / folder | ||
| + | |||
| + | 7 Read, Write and Execute Permissions - The User(s) can do everything - Read, Write & Execute the file / folder | ||