VectorLinux
August 22, 2014, 11:06:06 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Mounting network-drive directly to desktop?  (Read 6828 times)
SuSE-Refugee
Ex-Officio
Vectorite
****
Posts: 203


Dude In The Snappy Hat


« on: November 21, 2008, 05:50:28 am »

VL5.9std

The situation:
I have a home-network with two computers, a network-printer and a stand-alone network-drive(500GB) and I want to have that network-drive easily accessible from my user-account.
I know about the whole "mount as root using pyNeighborhood, then mount as user"-jig, but that I consider too much of a hassle.
I want that drive to be accessible to ALL users in an EASY way.
IOW : I want to have that drive mounted and opened with thunar via an icon on the desktop(XFCE).
I don't want to bother with rights and permissions for that drive; It's the public whore of my network anyway.(We use it to exchange files, to avoid having to create shared directories on the different systems)

Been messing with Samba a bit, but found, the *cough*documentation*cough* is totally useless, save for obfuscating matters...

In other words:
HELP!
Logged

<Lame sig>
brig001
Member
*
Posts: 31


« Reply #1 on: November 21, 2008, 07:47:47 am »

I have a shell script called .ConnectToServer.sh in the users home folder containing:

smbmount //IP_ADDRESS_HERE/SHARE_NAME_HERE /home/USER_NAME/MOUNT_POINT -o user=USER_NAME_HERE,password=PASSWORD_HERE

I added this to autostarted applications in XFCE and added a shortcut to the folder on the desktop after it was mounted.

I did this before I knew much about Linux and it could probably be done better, but it works.
The only oddity is that the shortcut displays as a broken link, but still works.
Logged
bigpaws
Vectorian
****
Posts: 1847


« Reply #2 on: November 21, 2008, 09:10:41 am »

Sounds like a job for fstab.

/dev/<name of drive>      /home/Suse/Desktop            reiserfs    defaults         0 0

Bigpaws
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4019



« Reply #3 on: November 21, 2008, 09:13:06 am »

My situation is similar. Here is how I do it:

- create a credentials file (mine is named /root/.creds) with content:
Code:
username=user_name_here
password=password_here

An advantage of using a credentials file instead of putting them in the mount command is that they don't show up in clear text when doing a "mount" command.

- as regular user, create the desired mount point (in my case: /home/username/samba)

- add the following to /etc/rc.d/rc.local:
Code:
mount -t cifs -o credentials=/root/.creds //192.168.1.xxx/share /home/username/samba &

I prefer cifs, as it does not have the 2G file size limit that smbfs does.
Logged
newt
Vectorian
****
Posts: 1132



« Reply #4 on: November 21, 2008, 11:14:03 am »

I like nightflier's idea but think that just mounting via fstab (like bigpaws mentioned) would work easiest.  I would make a change to the mount location nightflier suggested and mount in a more universal location; perhaps somewhere under /mnt (/mnt/storage; or some such thing).  Then each user can add a symlink to their home directory for /mnt/storage and everytime they open thunar you'll see your 'storage' location.

Make the credentials file owned and readable by root only (chown root.root /root/.creds && chmod 400 /root/.creds).
Create mount location (mkdir /mnt/storage)
Add fstab line to mount device, e.g.: //<IP_Address_of_Data_Storage>/<name_of_samba_share>    /mnt/storage    cifs    credentials=/root/.creds,<more_options>    0 0
Undoubtedly you will need to adjust the options of the mount command to make the mount location readable/writable by everyone; what exactly should go there - I don't know.
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4019



« Reply #5 on: November 21, 2008, 12:45:37 pm »

Problem I have found with using fstab: The network may not be up by the time it is processed.
Logged
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« Reply #6 on: November 21, 2008, 12:48:28 pm »

Yes, but it is still a good idea to have it in fstab, as then it should show up in the XFCE mount applet and can be added as a device on the KDE desktop, etc...
Logged

O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10
newt
Vectorian
****
Posts: 1132



« Reply #7 on: November 21, 2008, 01:39:42 pm »

Problem I have found with using fstab: The network may not be up by the time it is processed.

Very good point!!  I just looked at the mount man pages and it looks like there's an option to delay a mount action until the network is active.  I wonder if supplying the option would help deal with a down-network-at-mount-time problem.

Quote
_netdev
The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4019



« Reply #8 on: November 21, 2008, 02:33:48 pm »

Maybe just use fstab and add "mount -t cifs" to rc.local.. I gotta try that.
Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3179



« Reply #9 on: November 25, 2008, 08:54:06 pm »

My situation is similar. Here is how I do it:

- create a credentials file (mine is named /root/.creds) with content:
Code:
username=user_name_here
password=password_here

An advantage of using a credentials file instead of putting them in the mount command is that they don't show up in clear text when doing a "mount" command.

- as regular user, create the desired mount point (in my case: /home/username/samba)


Thanks, this worked for me
- add the following to /etc/rc.d/rc.local:
Code:
mount -t cifs -o credentials=/root/.creds //192.168.1.xxx/share /home/username/samba &

I prefer cifs, as it does not have the 2G file size limit that smbfs does.

Logged

M0E-lnx
Administrator
Vectorian
*****
Posts: 3179



« Reply #10 on: November 27, 2008, 06:27:36 pm »

I'm trying to make this work for me here...

I've created a script that does this for me... automates the mounting.. but there is one problem with it

the mount command requires root priviledges... so I can't execute it wm start up

Can anyone thingk of a way around it?
Logged

newt
Vectorian
****
Posts: 1132



« Reply #11 on: November 27, 2008, 09:52:49 pm »

Just a quick idea: Would sudo help in this situation?  Add your user to sudoers list and be able to execute the mount command. Or, maybe you would rather stay away from sudo?  Also, have you tried out the _netdev option and then just mounted via fstab?  If it happens in fstab you would avoid any kind of credentials/root-access situations, right?

Just thinking out loud here Cheesy
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4019



« Reply #12 on: November 28, 2008, 05:50:45 am »

I worked around this issue in 6.0 Light by installing /usr/sbin/mount.cifs suid root, and calling it directly:
/usr/sbin/mount.cifs //server/share /local/mount/point -o user=username,pass=password
Logged
sgla1
Member
*
Posts: 25


« Reply #13 on: January 11, 2009, 05:22:42 pm »

Problem I have found with using fstab: The network may not be up by the time it is processed.

That should not be the case -- Linux should be able to mount [nfs, cifs] shares at boot from fstab.  Check the order of your start-up scripts.

Some time ago I ran across a distro that had a race condition between nfs-mount and the nw initiation.  Our hack was to put the following in /etc/rc.local:
Code:
mount -a
Crude but it worked.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!