mount and umount shares on Lubuntu 15.04


Recommended Posts

Total Linux noob here :(

 

After some experimentation I came up with 2 shell commands to do what I wanted:

sudo mount.cifs //192.168.0.2/study_d /home/david/D_on_Study -o user=david,pass=___,rw,file_mode=0777,dir_mode=0777

and

sudo umount -f //192.168.0.2/study_d

(Using IP address because it won't find the machine name //study)

 

 

From these I want to create 2 desktop icons to execute these commands. This is where I am stuck.

 

Alternately, maybe one of you Linux guru's can tell me how to perform the share mount automatically on start up.

 

Thanks.

Link to comment
Share on other sites

Perhaps https://wiki.ubuntu.com/MountWindowsSharesPermanently will help. Most likely you will want to edit /etc/fstab.

 

In some cases you have to be careful as the startup scripts might run before you will be capable of mounting shares.

 

It might be worth making sure that you mount with the best SMB version possible. CIFS implies you will be using SMB1 (I'm not sure though). If you are using Windows 7 then try to mount using SMB2.1, or SMB3 for Windows 8.

At least try to use SMB2 as you can get large performance gains over SMB1.

Link to comment
Share on other sites

Thanks for the link.

 

The machine with the shares is Win 8.1. I have no idea to how to specify the SMB version to use.

Link to comment
Share on other sites

ok so the format is

mount -t cifs //windowsmachineip/sharename -o username=user,password=urPassword /mnt/share

/mnt/share is a folder on your linux machine you want to mount the share to

Link to comment
Share on other sites

What about from a desktop icon? I tried making a .SH file on the desktop with the commands in (as first post). Did not work.

 

BTW the person that will be using this is not an IT guy. Gotta make it easy as possible.

 

Thanks.

Link to comment
Share on other sites

sorry

 

edit your /etc/fstab

//servername/sharename  /media/windowsshare  cifs  guest,uid=1000,iocharset=utf8  0  0

add that line, guest means it needs no password, /media/windowsshare is the location on linux your mounting it to

 

uid=1000 means the user mounting it will have ownership of the files

Link to comment
Share on other sites

What about from a desktop icon? I tried making a .SH file on the desktop with the commands in (as first post). Did not work.

 

BTW the person that will be using this is not an IT guy. Gotta make it easy as possible.

 

Thanks.

 

For the desktop launcher you'd have to create a .desktop file. Those are usually either in /usr/share/applications if they'll be available for all users, or ~/.local/share/applications if it's for one single user.

Just copy and modify one of the existing .desktop files, changing the command to execute, the name, description, icon, etc...

 

That's for creating a launcher (so it shows up in the app menus) but then what you want is a launcher on your desktop. Just copy (or symlink) the file to the desktop folder in our $HOME, edit the file properties and check the checkbox for granting permissions to execute the file. As soon as the file has execute permissions you'll notice that the default icon for that .desktop file is replaced with the icon you have configured inside that file.

 

I have never created a .desktop to mount a filesystem, I'm not 100% sure if writing the whole mount command inside the .desktop file would work... if it doesn't, just create a .sh someone and point the .desktop file to execute that .sh instead.

 

And then for the extra mile, if you want to make the mount process really really easy and intuitive (considering that a launcher with the mount command alone doesn't provide any kind of feedback) coding a small node-webkit app that displays the state of the mountpoint along with a switch button to mount and unmount would be almost trivial  :p

 

 

*on a side note, if you configure mount points in fstab that aren't mounted automatically on boot, those will still show in the left panel in nautilus and can be mounted with a single click. That could be easier and more intuitive than a launcher, maybe (not sure about the default filemanager in lubuntu, though, maybe it'll work the same or maybe not).

Link to comment
Share on other sites

Ok that's great guys. That should be enough to get me sorted.

 

Thanks.

Link to comment
Share on other sites

Thanks all. I have learned quite a lot over the last few days.

 

I got it all working perfectly like this FSTAB example from one my Lubuntu installs:

//192.168.0.2/stg  /mnt/Mars_Stg  cifs  credentials=/home/dad/.smbcredentials,uid=1000,iocharset=utf8,sec=ntlm  0  0

It won't resolve //mars but i'm not too worried as the server has a fixed IP address via DHCP reservation.

 

Cheers.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.