2

I am trying to add the below entry to /etc/vfstab on Solaris 11.2 to mount a windows shared folder on reboot time:

//192.168.1.45/share    -   /mnt/winshare  smbfs    -   yes fileperms=0777,dirperms=777

the shared is working, mount folder exists, the only issue that I don't know how and where to set the domainname, username, password, and the other issue that my password having @ character on it so if I used some thing like user:p@ss@192.168.1.45 it won't work.

Kindly advice.

alanc
  • 1,500
  • 9
  • 12
masker
  • 21
  • 2

1 Answers1

2

As said at fstab and cifs mounting, possible to store authentication information outside of fstab? , you can use a credentials file:

credentials=filename: Specifies a file that contains a username and/or password. The format of the file is:

username=value
password=value    

This is preferred over having passwords in plaintext in a shared file, such as /etc/fstab. Be sure to protect any credentials file properly.

Example from /etc/fstab:

//192.168.1.45/share   /mnt/winshare   cifs   credentials=/root/.creda,domain=yourworkgroup

Be sure to limit file permissions to 600 on credentials file, and assure owner is root:root:

chown root:root /root/.creda
chmod 600 /root/.creda

Hope it helps!

emi
  • 279
  • 1
  • 8
  • I did that before with 0600, and I got unknown option "credintial", but I will try it again now – masker Dec 01 '15 at 10:38
  • Well, in fact, 0600 is still better than 0700. Corrected the answer. Also note you've got a typo: credintial vs credentials. – emi Dec 01 '15 at 10:41
  • Also forgot to ask: how about windows domain name, shall I add it to the credential file? – masker Dec 01 '15 at 10:41
  • Thanks for correcting I am trying now, will get back to you – masker Dec 01 '15 at 10:41
  • To fix the domain name, use `domain` option: `//192.168.1.45/share /mnt/winshare cifs credentials=/root/.creda,domain=yourworkgroup`. Updated the answer, too. – emi Dec 01 '15 at 10:44
  • There are plenty of options at the manual. Execute `man mount.cifs` to see them all. – emi Dec 01 '15 at 10:47
  • Still asking me for the password, I have noticed you are using only 4 fields while I am using 7 fields #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options Also I am using filetype smbfs, when i use cifs I got: FSType cifs is not installed on this system. My system is SunOracle Solaris 11.2 – masker Dec 01 '15 at 10:56
  • @emi Given you mention `/etc/fstab`, is your answer intended for a Linux server? – Andrew Henle Dec 02 '15 at 17:35
  • @AndrewHenle: yes, it is. Didn't noticed masker was talking about /etc/**v**fstab. – emi Dec 02 '15 at 19:09
  • @masker: mount.cifs is the solution Debian and Ubuntu are using to implement Samba, instead of old mount.smb . I don' t know Solaris very much. Maybe you can find `mount.cifs` on your package manager? – emi Dec 02 '15 at 19:13