Mount without root (fstab...)

Hello everyone,

Is it possible to edit the fstab where I will be able to mount shares without being the root user? I’m not sure if it’s working after I reboot the VM . It should mount the shares automatically after reboot. I couldn’t test it (respectively rebooting) because there are some developers who are working on the system.

my fstab is looking like this:


//myTest.intern/SAP_myTestPath /mnt/Alertlvl2 cifs credentials=/home/myTestUser/.cifscredentials,iocharset=utf8,sec=ntlm 0 0
//myTest.intern/SAP_myTestPath /mnt/Alertlvl3 cifs credentials=/home/myTestUser/.cifscredentials,iocharset=utf8,sec=ntlm 0 0
//myTest.intern/SAP_myTestPath /mnt/Alertlvl4 cifs credentials=/home/myTestUser/.cifscredentials,iocharset=utf8,sec=ntlm 0 0

my .cifscredential is looking like:

uid=testUser,
username=testUser,
password=password1234,

Is it possible to do the automount without the root user? I found this in the net: https://wiki.ubuntu.com/MountWindowsSharesPermanently#Special_permissions

The only way to realize this is the “sudo” thing. Like: sudo mount -a. A simply mount -a with my testUser isn’t working without the root password.

So please can you provide me a solution for this problem? It should be mounting without asking me for the root password for my testUser it should take the password automatically from the credential file. I think I’ve to edit my .cifscredential but I dont know how. Thank you in advance.

[QUOTE=Lordig;51638]Hello everyone,

Is it possible to edit the fstab where I will be able to mount shares without being the root user? I’m not sure if it’s working after I reboot the VM . It should mount the shares automatically after reboot. I couldn’t test it (respectively rebooting) because there are some developers who are working on the system.

my fstab is looking like this:


//myTest.intern/SAP_myTestPath /mnt/Alertlvl2 cifs credentials=/home/myTestUser/.cifscredentials,iocharset=utf8,sec=ntlm 0 0
//myTest.intern/SAP_myTestPath /mnt/Alertlvl3 cifs credentials=/home/myTestUser/.cifscredentials,iocharset=utf8,sec=ntlm 0 0
//myTest.intern/SAP_myTestPath /mnt/Alertlvl4 cifs credentials=/home/myTestUser/.cifscredentials,iocharset=utf8,sec=ntlm 0 0

my .cifscredential is looking like:

uid=testUser,
username=testUser,
password=password1234,

Is it possible to do the automount without the root user? I found this in the net: https://wiki.ubuntu.com/MountWindowsSharesPermanently#Special_permissions

The only way to realize this is the “sudo” thing. Like: sudo mount -a. A simply mount -a with my testUser isn’t working without the root password.

So please can you provide me a solution for this problem? It should be mounting without asking me for the root password for my testUser it should take the password automatically from the credential file. I think I’ve to edit my .cifscredential but I dont know how. Thank you in advance.[/QUOTE]
Hi
So are you wanting these shares available for all users at boot time, or is this just for your user?

If just your user, you can use Nautilus if running a desktop session, else look at fusermount. The other option is to add your user and the mount command to be run without a password with visudo.

[QUOTE=malcolmlewis;51651]Hi
So are you wanting these shares available for all users at boot time, or is this just for your user?

If just your user, you can use Nautilus if running a desktop session, else look at fusermount. The other option is to add your user and the mount command to be run without a password with visudo.[/QUOTE]
Hello malcolmlewis,

thanks for your response and yes. At least it doesnt really matte. I run SLES as OS for SAP and the my user testUser is like the admin-user. My problem is, that I’m not be able to mount without the root permession. I already read many solutions on the net, but noone of them worked fine for me.

Do I have to change my fstab? If I use fusermount I get the message: old style mounting not supported. visudo isn’t aswell on my system. I don’t know how I can mount the 3 shares without the root permission. I created a credential file where I use following paramters: uid=xxx,gid=xxx,username=xxx (probably unnessesary),password,auto.
If I unmount every filsystem and use following command: mount -a it says only root has the permission for -all.

[QUOTE=Lordig;51656]Hello malcolmlewis,

thanks for your response and yes. At least it doesnt really matte. I run SLES as OS for SAP and the my user testUser is like the admin-user. My problem is, that I’m not be able to mount without the root permession. I already read many solutions on the net, but noone of them worked fine for me.

Do I have to change my fstab? If I use fusermount I get the message: old style mounting not supported. visudo isn’t aswell on my system. I don’t know how I can mount the 3 shares without the root permission. I created a credential file where I use following paramters: uid=xxx,gid=xxx,username=xxx (probably unnessesary),password,auto.
If I unmount every filsystem and use following command: mount -a it says only root has the permission for -all.[/QUOTE]
Hi
So you don’t have root access then?

What about this command;

gvfs-mount //myTest.intern/SAP_myTestPath
gvfs-mount -l

[QUOTE=malcolmlewis;51658]Hi
So you don’t have root access then?

What about this command;

gvfs-mount //myTest.intern/SAP_myTestPath gvfs-mount -l [/QUOTE]

Hi,
I’ve the root password aswell. But SAP and SLES are communicating with via my “xxxUser”. Of course I could implement the whole thing via root without any problems, but we had to use our own user because of the risks with root. Another problem is that process between SAP and SLES wouldn’t work as well.
The command gvfs-mount is not working for us-> command not found. I already installed the whole package and its still not found.

Is it not possible to that that with cifs?

[QUOTE=Lordig;51683]Hi,
I’ve the root password aswell. But SAP and SLES are communicating with via my “xxxUser”. Of course I could implement the whole thing via root without any problems, but we had to use our own user because of the risks with root. Another problem is that process between SAP and SLES wouldn’t work as well.
The command gvfs-mount is not working for us-> command not found. I already installed the whole package and its still not found.

Is it not possible to that that with cifs?[/QUOTE]
Hi
So what gvfs packages are installed, one should be gvfs-backend-samba (userland cifs support).

zypper se -i gvfs

The other option is to add your user via visudo to enable use of the mount command…

Hi,

there are no matching itmes found if I run the command. I’m quiet new in SLES and sorry for my lack of experience. I’m still in the learn process :slight_smile:

With yast I added my user to the specific sudo command. But how I know it will possibly solve my problem (expect of a system reboot)?

I edited the fstab already. It seems, if I use the following command: sudo mount -a it will mount it without asking me for the Windows-Password for the mount path.

Is there any other way to check it if the automounting works?

Hi,

sorry for jumping in late - there’s also the “user” option to the mount, which you can specify in /etc/fstab (no use on the command line, for obvious reasons).

For the casual reader: There are some non-obvious side effects, like “user” resetting certain options, so you’d need to specify “user” first in the list of options for some other options to take effect. And you may run into trouble umounting, the “user” option does no good for that, at least not always.

Regards,
J

[QUOTE=jmozdzen;51735]Hi,

sorry for jumping in late - there’s also the “user” option to the mount, which you can specify in /etc/fstab (no use on the command line, for obvious reasons).

For the casual reader: There are some non-obvious side effects, like “user” resetting certain options, so you’d need to specify “user” first in the list of options for some other options to take effect. And you may run into trouble umounting, the “user” option does no good for that, at least not always.

Regards,
J[/QUOTE]

hi
Thank you for your response. So is it better to specify the user? I do it both but I think it has zero affect. With username=myTestUser it should be fine right? Or do I have to edit some other file where I have to add the myTestUser?

At least my solution works, but as I said, I’m new in SLES :slight_smile: thank you for helping me out! Good community here!

Hi,

just to avoid a potential misunderstanding: From “man 8 mount”:

[QUOTE] user Allow an ordinary user to mount the filesystem. The name of the mounting user is written to the mtab file (or to the private libmount file in /run/mount on systems without a regular mtab) so that this same user can unmount the filesystem again.
This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).[/QUOTE]

So “user” is a flag, telling the system that an ordinary user may mount that file system - rather than needing to be root. “user” is no way to specify which user, unlike the “username=someuser” option/value pair.

With other words, my reply tried to address the “Is it possible to edit the fstab where I will be able to mount shares without being the root user?” part of your initial question.

Regards,
Jens