Tag Archives: linux tips

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 ( grep the text without hashes and blank lines )

In our second post of linux tips i would like to share a very simple example in which i will use grep tool to remove all the hashes and blank lines from a file.

In our example we will use file1.txt with the following content

linux-11oz:/test # cat file.txt 
#The file with hashes
###
####
##

This is a test file

With lots of spaces


and few lines with


####hashes
###

So lets remove the hashes and blank lines with single grep command

We can use the following trick

linux-11oz:/test # grep . file.txt | grep -v "#"
This is a test file
With lots of spaces
and few lines with

The “.” will remove the blank lines andĀ  “-v” will invert the match of #

Thats how simple it is. If you know a better way of doing it , Please send me an email or comment.

Email: learning@itpings.com

Thanks

Salman A. Francis