Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to share a folder (including subfolders) on my NAS ( WD MyBook World Ed. WhiteLight) with a friend over internet (FTP).
So far I created a user, installed vsftpd and set to jail it's users in their /home directory. Now say, there is a folder /shares/music which I want to appear readable only in /home/user.
Do I use the mount command or should I go different path?
I don't know. Well, I don't know what a symbolic link is or what is it used for. Simply, I want a remote user to access his /home folder, where he can download data from another folder on the hard drive. So the contents of this "another" folder would be listed in his home folder as read only.
a symbolik link, as suggested by jdk, corresponds exactly to a "shortcut" in Windows. Just create a symlink from the user's home dir to /shares/music and make sure that /shares/music and the files contained therein are not writable for the user.
well, not the way I want, but I mean, the symlink worked
My problem now is that ftp sends error 500, but when I log in as root and go there, it takes me where it points to. Is it because the user is jailed to it's /home folder?
----------
EDIT
----------
also if I connect via phone using ES File Manager this symlink doesn't work as shortcut but phone wants to open it as video/audio/text/etc .... wouldn't the mount command work better here?
mount --bind works the way I want, but have 2 more questions on how to and that is:
1. How do I represent spaces in path when typing command in putty? ie "/shares/Music/Hip Hop" won't work because of the space before last word
2. when I mount like this: "mount --bind /shares/Music /home/user" - how do I unmount later? tried "umount /shares/Music" but didn't work, it says "couldn't umount, invalid argument".
Also, shouldn't "mount -l" list all mounted devices including my bind folder?
----------
EDIT
----------
also, a bit off topic, when I ssh this user into my NAS he can see all contents (can't write though) of the hard drive, how do I make this visible to root only?
1. How do I represent spaces in path when typing command in putty? ie "/shares/Music/Hip Hop" won't work because of the space before last word
Enclose the path in quotation marks, or add a backslash (\) before every space.
Code:
Also, shouldn't "mount -l" list all mounted devices including my bind folder?
Yes! That your share folder isn't listed and the "invalid argument" error message indicate that mounting didn't work. Try mount with the -v option ("verbose").
Also, shouldn't "mount -l" list all mounted devices including my bind folder?
Yes! That your share folder isn't listed and the "invalid argument" error message indicate that mounting didn't work. Try mount with the -v option ("verbose").
well, it does, I can see contents of the folder when I go into /home/user but it's not listed within the mounted devices
also, when I try
Code:
mount --bind -o ro /shares/music /home/user/test
I can go into /home/user/test and see the contents of /shares/music but it's NOT read only. I'm afraid to chmod it to 444, don't know whether that happens to the "shortcut" folder or to the actual /shares/music folder
----------
EDIT
----------
just to show, mount -l shows this:
Code:
securityfs on /sys/kernel/security type securityfs (rw)
/dev/md2 on /DataVolume type xfs (rw,usrquota) []
/dev/md4 on /ExtendVolume type xfs (rw,usrquota)
2. when I mount like this: "mount --bind /shares/Music /home/user" - how do I unmount later? tried "umount /shares/Music" but didn't work, it says "couldn't umount, invalid argument".
Usually unmouting is done by mountpoint, not mounted "device". Try "umount /home/user" or "umount /home/user/test" (wherever you mounted).
Quote:
Also, shouldn't "mount -l" list all mounted devices including my bind folder?
It should.
Quote:
I can go into /home/user/test and see the contents of /shares/music but it's NOT read only.
It should.
Are you using busybox? The last two problems may be connected with that. It is simplified program, some tools may not work with "full potential". Also your /etc may be mounted read only, or /etc/mtab is not writable, therefore mount/umount can not store data it need for unmouting and listing. Try "cat /proc/mounts" if you have proc mounted.
Quote:
I'm afraid to chmod it to 444, don't know whether that happens to the "shortcut" folder or to the actual /shares/music folder
Always to actual folder. Permissions of this shortcut folder (called mountpoint) is not taken into account. But remember about subdirectories, they also need proper permissions, 0755 should be sufficient or 0750 (with proper group set for users and this folder).
eSelix ... yes I'm using busybox (2.26 I think it is) what looks like the main problem is
cat /proc/mounts returns all mountpoints including those mount by me and for some strange reason I wasn't able to unmount /home/user before I unmount /shares/user (which I must have accidentaly created)
also I have a root access so I can change anything I guess
anyway thank you, I think I found answers I was looking for, time to go sleep now, will try once again tomorrow.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.