G Drive mounting script


#1

A (bash?) script needs to be made for mounting users home drives from the Universities system. The script on launch will ask for the users university username and password.

This script needs to work in userspace so no sudo/root privilidges required!

Tried using this command but it didn’t want to authenticate against the university servers.

gio mount 'smb://domain;username@IPaddress/sharedfolder'

Sharepoint info for mounting drives:
https://share.hull.ac.uk/Services/ICT/SitePages/Network%20Drives%20-%20Windows.aspx


#2

You’ll definitely want to investigate FUSE for this. I’ve mounted SAMBA / CIFS shares from the CLI before, so I might be able to cook something up if / when I gain access to the room. Remind me :stuck_out_tongue:


#3

The desktops have SSH setup if you want to have a go at it now?


#4

Erm can do? Could you PM me the details on discord? I don’t currently have VPN access to the university setup.


#5

#6

Ok, I’ve investigated mounting university shares.

Basically, we need the gio mount command. So I could do this:

gio mount smb://486016@data.adir.hull.ac.uk/satahome4/486/486016

…but it won’t let me, because it claims Failed to mount Windows share: Function not implemented. Apparently the solution to this is to mount with sec=ntlm, but the man page for gio mount doesn’t detail how I can specify this.

So currently you’ve gotta be root to mount your G: & Z: drives.

I found the following script in my ~/bin folder. These commands work for me on Ubuntu:

sudo mount -t cifs -o username=486016,rw,nounix,iocharset=utf8,file_mode=0775,dir_mode=0775,uid=1000 //data.adir.hull.ac.uk/~486016 /media/sbrl/486016-G
sudo mount -t cifs -o username=486016,rw,nounix,iocharset=utf8,file_mode=0775,dir_mode=0775,uid=1000 //data.adir.hull.ac.uk/satahome4/486/486016 /media/sbrl/486016-Z

(Link to original file in my bin folder)

I’d forgotten I wrote that script :stuck_out_tongue:

If anyone has further issues with that, you can add sec=ntlm to the end of the comma-separate list of options I’ve specified there with -o.

Sources


#7

I think it’s an issue on a samba level

smbclient //data.adir.hull.ac.uk//satahome5//505//505618 -U 'ADIR\505618'
Enter ADIR\505618's password:
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

#8

Hrm. Not sure then!


#9

Figured something out. Requires smbnetfs

cp /usr/share/doc/smbnetfs-0.6.1/smbnetfs.conf ~/.smb/smbnetfs.conf
smbnetfs ~/mnt
cd ~/mnt/username:password@cna-cifs.adir.hull.ac.uk/home5/5xx/username

Should be possible to put the password in ~/.smb/smbnetfs.auth should probably make that file delete on logoff?


#10

Yay! That looks like it’d work. We could write a .desktop file that starts a yad-powered GUI that calls those commands.

[Desktop Entry]
Name=University Documents Mounter
Comment=Mounts your University G: drive.
Exec=/usr/bin/university-mounter
Terminal=false
Type=Application
Icon={insert-name-here}