Hi, I'm using Trinity 3.5.13.2 that was installed with exe GNU linux.
I have a bash script to mount a shared folder from a remote server and open it in a window. I launch it from a desktop icon. It looks like this:
sudo mount 192.168.0.2:/home/dpjungk/Share /mnt/nfs/client1 nautilus /mnt/nfs/client1
It works fine -- except that, if I close the window and want to reopen it, it obviously asks for the password every time.
Is there a way to check to see if it is mounted so that it only asks for the password if it is the first time?
Thank you for your time,
Don
Hi You can look it in /etc/mtab
Fast solution would be this:
[ -z "$(grep /mnt/nfs/client1 /etc/mtab)" ] && sudo mount 192.168.0.2:/home/dpjungk/Share /mnt/nfs/client1 nautilus /mnt/nfs/client1
Cheers, Adonay-Jonay Sanz www.kademar.org
El 05/04/15 a les 23:37, multi ha escrit:
Hi, I'm using Trinity 3.5.13.2 that was installed with exe GNU linux.
I have a bash script to mount a shared folder from a remote server and open it in a window. I launch it from a desktop icon. It looks like this:
sudo mount 192.168.0.2:/home/dpjungk/Share /mnt/nfs/client1 nautilus /mnt/nfs/client1
It works fine -- except that, if I close the window and want to reopen it, it obviously asks for the password every time.
Is there a way to check to see if it is mounted so that it only asks for the password if it is the first time?
Thank you for your time,
Don
To unsubscribe, e-mail: trinity-users-unsubscribe@lists.pearsoncomputing.net For additional commands, e-mail: trinity-users-help@lists.pearsoncomputing.net Read list messages on the web archive: http://trinity-users.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting
On 04/05/2015 05:37 PM, multi wrote:
Hi, I'm using Trinity 3.5.13.2 that was installed with exe GNU linux.
I have a bash script to mount a shared folder from a remote server and open it in a window. I launch it from a desktop icon. It looks like this:
sudo mount 192.168.0.2:/home/dpjungk/Share /mnt/nfs/client1 nautilus /mnt/nfs/client1
It works fine -- except that, if I close the window and want to reopen it, it obviously asks for the password every time.
Is there a way to check to see if it is mounted so that it only asks for the password if it is the first time?
Thank you for your time,
Don
To unsubscribe, e-mail: trinity-users-unsubscribe@lists.pearsoncomputing.net For additional commands, e-mail: trinity-users-help@lists.pearsoncomputing.net Read list messages on the web archive: http://trinity-users.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting
How about something like:
if ! ( mount | grep "/mnt/nfs/client1"); then echo "not mounted" echo "I'm afraid I'm going to have to ask for your password..." fi
Tony
Hi Tony and Jonay,
Both answers work fine, thank you.
Don
On Sun, 5 Apr 2015 16:37:42 -0500 multi multi@flippingdades.com wrote:
I'm using Trinity 3.5.13.2 that was installed with exe GNU linux.
I have a bash script to mount a shared folder from a remote server and open it in a window. I launch it from a desktop icon. It looks like this:
sudo mount 192.168.0.2:/home/dpjungk/Share /mnt/nfs/client1 nautilus /mnt/nfs/client1
It works fine -- except that, if I close the window and want to reopen it, it obviously asks for the password every time.
Is there a way to check to see if it is mounted so that it only asks for the password if it is the first time?
You already received a lot of replies about how to check if its mounted, but i think the better way would be to either put a relevant line in fstab with a user flag so you can avoid sudo or (even better) set up an automounter (i use autofs, but there are others).
On Monday 06 April 2015 15:44:27 Nick Koretsky wrote:
On Sun, 5 Apr 2015 16:37:42 -0500 multi multi@flippingdades.com wrote:
I'm using Trinity 3.5.13.2 that was installed with exe GNU linux.
I have a bash script to mount a shared folder from a remote server and open it in a window. I launch it from a desktop icon. It looks like this:
sudo mount 192.168.0.2:/home/dpjungk/Share /mnt/nfs/client1 nautilus /mnt/nfs/client1
It works fine -- except that, if I close the window and want to reopen it, it obviously asks for the password every time.
Is there a way to check to see if it is mounted so that it only asks for the password if it is the first time?
You already received a lot of replies about how to check if its mounted, but i think the better way would be to either put a relevant line in fstab with a user flag so you can avoid sudo or (even better) set up an automounter (i use autofs, but there are others).
-- Nick Koretsky (nick.koretsky@gmail.com)
Hi Nick, Actually, the first thing I did was put the line in fstab. Curiously, it would not mount the shared folder at boot time, but after it was booted, I could mount it with 'mount -a'. I thought maybe fstab was being read before the ethernet connection was established.
But, I didn't pursue this because the remote folder is not always available at bot time. Depends on which computer is booted first. So I still needed to mount it later, which I do have now.
The autofs looks like it might be helpful. Thank you for mentioning it.
Don
On Tue, 7 Apr 2015 14:26:57 -0500 multi multi@flippingdades.com wrote:
Actually, the first thing I did was put the line in fstab. Curiously, it would not mount the shared folder at boot time, but after it was booted, I could mount it with 'mount -a'. I thought maybe fstab was being read before the ethernet connection was established.
But, I didn't pursue this because the remote folder is not always available at bot time. Depends on which computer is booted first. So I still needed to mount it later, which I do have now.
fstab doesnt necessary means boot time :)
You cant put something like this in it
192.168.1.254:/nas /mnt/nas nfs4 rw,hard,rsize=32768,wsize=32768,relatime,user,noauto 0 0
it wont try to connect at boot time and you will be able to mount it as user with a simple "mount /mnt/nas" without the need of sudo and passwords.
The autofs looks like it might be helpful. Thank you for mentioning it.