Tag Archives: linux tricks

Sharing a Folder among Two FTP users

This might be a very simple article for many people but for some it holds the key for a very good & stable solution.

Scenario:
Two users who want to share a folder and upload data. “User A” and “User B”. They are both restricted to their home directories when they connect with FTP. The folder is actually a shared storage where both the users will upload data. Shared storage is mounted under /Bigdata.

Solution:

Create a Directory in home directory of both the users and call it “OurData”

# cd /home/user-A
# mkdir OurData

Now mount the directory with bind option
#mount –bind OurData/ /BigData/

Make it permanent in fstab

vim /etc/fstab

/BigData /home/user-A/OurData none bind 0 0

Repeat the same for User-B

Make sure the following:
1) Make Both users member of same group , lets call it data
2)Give proper permissions to BigData folder  such as 770
3) Setup acl with setfacl for both users.

Now they can connect with FTP and share the data without any issues.

Thanks,
Salman A. Francis
ITpings.com
www.YouTube/Linuxking
Facebook.com/Linuxking77

Linux Tips ( chmod tip )

Hey Guys this is going to be a new series of posts in which i will be sharing some cool linux tips.  You can watch the video of this post on http://www.youtube.com/linuxking

So here is the first tip Chmod:

I hope you guys are already familiar with chmod command if not checkout my Youtube “Linuxking” channel for theses commands.

With Chmod you can change the mode of the files and directories.
e.g
chmod 775 dir  command will change the permission on directory with rwxrwxrw-

Also using -R option with chmod will change the permission on the directory as well the content within the directory with same permissions.

However lets say you want to change the permissions of a directories to executable within a directory without changing permissions of file use the below tip.

Lets say you have a directory “test1” & “test2” inside “test” directory

test directory has also a  file inside it called file1.txt

file1.txt has permission rw——-

directory test1 has permission rwx——

directory test2 has permission rw——-

linux-11oz:/test # ls -ltr
total 0
-rw------- 1 root root 0 Mar 22 17:06 file.txt
drwx------ 1 root root 0 Mar 22 17:07 test2
drwx------ 1 root root 0 Mar 22 17:07 test1

Now if you try to change the permission with a simple ” chmod -R command ” of all the directories to “executable” inside test directory you could also change permission of the file inside test diretory.

Example:

linux-11oz:/ # chmod -R ug+x test/
linux-11oz:/ # cd test/
linux-11oz:/test # ls -ltr
total 0
-rwx--x--- 1 root root 0 Mar 22 17:06 file.txt  (You can see that the file also became executable)
drwx--x--- 1 root root 0 Mar 22 17:07 test2
drwx--x--- 1 root root 0 Mar 22 17:07 test1

Now to avoid such situation we will use X instead of x, lets see the impact of X with chmod command

linux-11oz:/ # chmod -R ug+X test/
linux-11oz:/ # cd test/
linux-11oz:/test # ls -ltr
total 0
-rw------- 1 root root 0 Mar 22 17:06 file.txt (You can see the file's permission has not changed to executable)
drwx--x--- 1 root root 0 Mar 22 17:07 test2
drwx--x--- 1 root root 0 Mar 22 17:07 test1
linux-11oz:/test #

I hope you have Enjoyed this tip, keep visiting our site for more information.