LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 08-16-2013, 11:26 PM   #1
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Rep: Reputation: Disabled
Windows-sort-of shortcut


Hello, can anyone help a noob please?

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?

Thank you for any advice.
 
Old 08-17-2013, 12:04 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Would a (symbolic) link do the job?
jdk
 
Old 08-17-2013, 12:18 AM   #3
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-17-2013, 02:26 AM   #4
moo-cow
Member
 
Registered: Mar 2006
Distribution: Debian
Posts: 105

Rep: Reputation: 26
Hi,

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.

PS: You can create a symlink using ln.

Last edited by moo-cow; 08-17-2013 at 02:46 AM.
 
1 members found this post helpful.
Old 08-17-2013, 06:13 AM   #5
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
oh yes, thank you, that worked

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?

Last edited by esso82; 08-17-2013 at 06:36 AM.
 
Old 08-17-2013, 08:17 AM   #6
moo-cow
Member
 
Registered: Mar 2006
Distribution: Debian
Posts: 105

Rep: Reputation: 26
Code:
wouldn't the mount command work better here?
Try it out! But note that the command will only mount devices, e.g. disk partitions.
 
Old 08-17-2013, 08:31 AM   #7
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Symlink will not work due jail. That way anybody could create symlink to other place and read data outside jail. You can do
Code:
mkdir /home/user/shared_music
mount --bind /shares/music /home/user/shared_music
 
1 members found this post helpful.
Old 08-17-2013, 09:48 AM   #8
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
OK, we're getting there

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?

Last edited by esso82; 08-17-2013 at 09:56 AM.
 
Old 08-17-2013, 09:58 AM   #9
moo-cow
Member
 
Registered: Mar 2006
Distribution: Debian
Posts: 105

Rep: Reputation: 26
Code:
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").
 
Old 08-17-2013, 10:07 AM   #10
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by moo-cow View Post
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").
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)
even tho I mounted two more folders now

Last edited by esso82; 08-17-2013 at 10:15 AM.
 
Old 08-17-2013, 03:08 PM   #11
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Quote:
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).

Last edited by eSelix; 08-17-2013 at 03:19 PM.
 
1 members found this post helpful.
Old 08-17-2013, 04:07 PM   #12
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Analogy to Windows shortcut that's NOT a symlink? doncristobal Linux - Newbie 4 02-01-2013 11:23 AM
linux following through a windows shortcut? khaos83 Linux - General 5 12-18-2008 02:59 AM
reboot into windows button / shortcut pistonbrew Linux - Software 1 04-26-2005 10:50 PM
Shortcut for Windows vwal_13 Slackware 4 05-14-2004 01:18 PM
Boot in windows shortcut graffitici Linux - Software 1 01-08-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration