Linux windows mounts


We sometimes you just want to mount a windows share and don’t really want to go through the pain of samba etc.. so you look for the down and dirty username and password file (password in plain text down and dirty as I said) mount command.

 

I did this a few years ago and everything worked fine. On a new installation today, I followed the normal method of achieving this as I have done in the past.

The details of the os are as follows :-

uname -r 3.10.0-123.el7.x86_64

cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core)

Install the cifs utilities so mounting is possible

yum install cifs-utils
mkdir ~.sharecredentials
echo "username=DOMAIN.LOCAL\Username" > ~/.sharecredentials/credentials
echo "password=secretpassword" >>> ~/.sharecredentials/credentials
chmod -R 600 ~/.sharecredentials

Now create the directory where the mount will sit

mkdir /mnt/windowsshare

Edit fstab as you would do normally and add the following :-

//fileshare.domain.local/shareddirectory /mnt/windowsshare cifs credentials=/root/.sharecredentials/credentials,_netdev, 0 0

mount -a

And suddenly I get the error

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

tail /var/log/messages

May 22 08:07:56 webserver-01 kernel: Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
May 22 08:07:56 webserver-01 kernel: CIFS VFS: Send error in SessSetup = -13
May 22 08:07:56 webserver-01 kernel: CIFS VFS: cifs_mount failed w/return code = -13
May 22 08:08:21 webserver-01 kernel: Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
May 22 08:08:21 webserver-01 kernel: CIFS VFS: Send error in SessSetup = -13
May 22 08:08:21 webserver-01 kernel: CIFS VFS: cifs_mount failed w/return code = -13
May 22 08:09:45 webserver-01 kernel: Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
May 22 08:09:45 webserver-01 kernel: CIFS VFS: Send error in SessSetup = -13
May 22 08:09:45 webserver-01 kernel: CIFS VFS: cifs_mount failed w/return code = -13

No you would think that you might have the password wrong, but no. The syntax of the credentials file has changed, only a little but just enough.

The syntax should now read

username=

password=

domain=

so in our instance

username=username

password=secretpassword

domain=domain.local

mount -a  is now successful

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s