You are not logged in.
Pages: 1
A member asked this over on the Zorin forum. He would like to have a remote folder on a windows machine automount. However, he would like it to automount AFTER login.
He already has set up the network to start at boot rather than login, so we cannot set it to wait for network.
All I can think of (And other suggestions welcome) would be to create a script to run at login that mounts the remote folder. But I'm not confident enough to try writing it.
Any suggestions?
Offline
Personally, I use autofs for this. The drives aren't actually mounted until you click on (or enter) the mount point. For more info, see https://wiki.archlinux.org/index.php/Autofs.
However, if you are looking for a script to run, you can use gvfs/gio to automate mounts. To make so that you don't have to enter in credentials, first create the file ~/.creds with the following content:
username
workgroup
password
...so it looks something like this:
toz
WORKGROUP
mypassword
Then you can use a command like this:
gio mount smb://Server/Music < .creds
...to mount the remote share (in this case an smb share). It will show up in thunar as a mounted volume in the NETWORK section.
You can create a script to do multiple mounts:
#!/bin/sh
gio mount smb://Server/Music < .creds
gio mount smb://Server/Pictures < .creds
gio mount smb://Server/Videos < .creds
...and add it to your autostart applications to have it start when you log in.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Toz, you are amazing. Thanks. However, this is what he had to say:
TK1
Unfortunately, this doesn't work because I don't want a password in a clear text file.I tried putting only the user and domain in the .creds file hoping it would prompt me for the password, but it doesn't. I tried this from a terminal with that .creds file, but it doesn't prompt and wait for the password.
If I could get it to prompt me for the password, I think this would work, but I don't see an option for that.
Offline
Okay, without a credentials file asking for password, you could use:
gio mount smb://WORKGOUP\;USER@SERVER/SHARE
However, you need to manually run this in a terminal window because it will ask you to enter in a password. You could use something like zenity to prompt for a password in a window if you want to automate it.
Is autofs out of the question? It really is the simpler way.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Hi ToZ, I'm the one from the other forum asking about this. I appreciate Aravisian doing me a favor by being the middle man but that's not fair to him or her, so I'll just jump in here.
Autofs is not feasible for me because I have the network starting before logging in (I know this is not the default), and I don't want the share mounted prior to logging in. Another reason is it will auto-unmount it after a period of time and I don't want that.
From a terminal, this worked:
zenity --password | gio mount smb://windowspc\;me@windowspc/sharename$
This does prompt me and works after the password is entered, although it's apparently discouraged because "GtkDialog mapped without a transient parent". I don't know what that means.
When I tried putting the same line in Startup Applications, it did not mount the share even though it did prompt for a password after the log in.
Thank you for your help and suggestions!
tk1
Last edited by tk1 (2020-01-25 05:00:56)
Offline
Hi ToZ, I'm the one from the other forum asking about this. I appreciate Aravisian doing me a favor by being the middle man but that's not fair to him or her, so I'll just jump in here.
Him.
It's a great forum and Toz is among the most helpful Linux Forum contributors I've seen.
Welcome to it.
Offline
The warning "GtkDialog mapped without a transient parent" is a common thing to see, especially when using Zenity, and is a harmless warning.
I didn't take proper notes, but I have 2 ways of stopping the warning. I believe the second allows actual errors to still come through:
zenity --info --text "hello" 2> /dev/null
zenity --info --text "hello" 2> >(grep -v 'GtkDialog' >&2)
As for Startup Applications, I'm guessing the pipe is a bashism so it might need to start with
bash -c 'zenity --password | gio mount smb://windowspc\;user@windowspc/sharename$'
Someone may correct me on that one.
Offline
If I'm correct, the full line would be
bash -c 'zenity --password | gio mount smb://windowspc\;user@windowspc/sharename$ 2> >(grep -v 'GtkDialog' >&2)'
Offline
When I tried putting the same line in Startup Applications, it did not mount the share even though it did prompt for a password after the log in.
I'll bet it's because of the escaped characters - the mini-interpreter that it uses is not that robust. @MrEen's suggestion should work.
You might also want to have a look at the gigolo app. From what I remember, you can create your connection "bookmarks" and set them to automount. Then all you would need to do is add gigolo to your autostart.
Welcome to the forums, btw.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
If I'm correct, the full line would be
bash -c 'zenity --password | gio mount smb://windowspc\;user@windowspc/sharename$ 2> >(grep -v 'GtkDialog' >&2)'
The good news is that this did work. After logging in, I'm immediately prompted for a password, and once entered the share is mounted and I can access it (e.g. with Thunar).
The bad news is a windows program I need to use (which is one of the reasons for needing this), can't access it because of the special characters. So I'm back to square one.
Is there another way to do this? Maybe one that uses CIFS instead of SMB (from what I understand, CIFS is better/more desirable)?
tk1
Offline
a windows program
I'm guessing by the crickets, I said something wrong..
Offline
tk1 wrote:a windows program
I'm guessing by the crickets, I said something wrong..
Not at all, don't worry, we just don't have an answer yet. I'm sure it'll come up!
Offline
The bad news is a windows program I need to use (which is one of the reasons for needing this), can't access it because of the special characters. So I'm back to square one.
What do you mean by this statement? The above command is a linux command/action. How exactly does the Windows program fit into this?
Once mounted, the windows program should be able to find the shared folder at /run/user/XXX/gvfs/sharename, where XXX is your userid (from: "id -u").
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Not at all, don't worry, we just don't have an answer yet. I'm sure it'll come up!
lol, whew! Ok, thank you.
How exactly does the Windows program fit into this?
Once mounted, the windows program should be able to find the shared folder at /run/user/XXX/gvfs/sharename, where XXX is your userid (from: "id -u").
Ok, a little back story. I'm moving from Windows to Linux, but I have data on a different system that is still Windows. My system has a fairly new install of Zorin OS. To clarify, system 1 has Zorin OS, while system 2 has Windows.
So, on system 1 (Zorin OS), I'm using wine to run a Windows program I need. That program needs to open a file on system 2 (Windows).
When I try to browse from the program on sys 1 to the share on sys 2, it tells me the filename can't have / : < > |
This is where I'm browsing to so you can see the characters it's complaining about (I did replace the XXX with my userid btw):
/run/user/XXX/gvfs/smb-share:domain=windowspc,server=windowspc,share=sharename$,user=me
I hope this is clear, if not let me know.
Thank you for your help and keep the questions coming.
tk1
Offline
I'm assuming this entry in fstab still exists:
//windowspc/sharename$ /home/me/windowsshare cifs vers=2.1,username=user,uid=1000,gid=100,dir_mode=0777,file_mode=0666 0 0
[1] If the share is mounted unmount it:
sudo umount /home/me/windowsshare
[2] Create a launcher: Right click the desktop > Create launcher
[3] For the Command:
mount /mnt/windowsshare
, check the Run in Terminal box, and select an icon.
[3] Create a mount point at /mnt/windowsshare
[4] Edit /etc/fstab and chage your current entry from this:
//windowspc/sharename$ /home/me/windowsshare cifs vers=2.1,username=user,uid=1000,gid=100,dir_mode=0777,file_mode=0666 0 0
To this:
//windowspc/sharename$ /mnt/windowsshare cifs vers=2.1,username=user,uid=1000,gid=100,dir_mode=0777,file_mode=0666,noauto,user 0 0
Note: the "user" after the "noauto" operative is literal. It's not your use name.
[5] Restart the daemons:
sudo systemctl daemon-reload
[6] Double click the desktop icon.
A terminal will open up requesting your password for "user" on the Windows box.
You can create a link or bookmark from the /mnt/windowsshare mount point to the side panel of thunar if you want.
EDIT Or ........... if you don't want to use a desktop launcher you could add an entry into your autostart applications settings: Settings > Session and Startup > Application Autostart > Add
Then for the command enter:
xfce4-terminal -e 'mount /mnt/windowsshare'
Last edited by Morbius1 (2020-01-25 15:53:10)
Offline
I see. Windows can't process the ":" and name of the share includes one. I've personally been using autoFS and don't run into this problem, however, testing with gio mount in this wine scenario, I can see the same issue.
Found some interesting bug reports:
- https://bugs.launchpad.net/ubuntu/+sour … ug/1075868 - the workaround script doesn't work for me as doesn't creating a symbolic link
- [https://forum.winehq.org/viewtopic.php? … &view=next]
...so it looks like a known issue.
Are you willing to re-consider autofs? It works flawlessly for me.
Autofs is not feasible for me because I have the network starting before logging in (I know this is not the default), and I don't want the share mounted prior to logging in.
The share won't mount until you try to access it. It will not affect system startup.
Another reason is it will auto-unmount it after a period of time and I don't want that.
If you set the "--timeout" value to 0, it will disable the unmounting action. From "man automount":
-t <seconds>, --timeout <seconds>
Set the global minimum timeout, in seconds, until directories are
unmounted. The default is 10 minutes. Setting the timeout to zero
disables umounts completely. The internal program default is 10
minutes, but the default installed configuration overrides this
and sets the timeout to 5 minutes to be consistent with earlier
autofs releases.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Pages: 1