ruebenramirez / blog

My blog
http://blog.ruebenramirez.com/
7 stars 0 forks source link

troubleshooting cifs shares #333

Open ruebenramirez opened 8 years ago

ruebenramirez commented 8 years ago

mount a windows share

create a mount directory

sudo mkdir /mnt/share

create a credentials file:

vim ~/.Smbcredentials

contents of ~/.Smbcredentials

username=user
password=s3cr3t
domain=companyABC

mount the share

sudo mount -t cifs //server/share /mnt/share/ -o credentials=~/.Smbcredentials

troubleshooting

verbose mount

If you're having problems try using the -v (verbose) feature of the mount command:

sudo mount -v -t cifs //host/share-dir ~/mnt/share/ -o credentials=~/.Smbcredentials 

Check credentials with smbclient

Try checking your password with smbclient

sudo apt-get install smbclient

test your username and credentials with:

smbclient //server/share -U domain\\username

smbclient will prompt you for a password

or you can delimit your credentials with a %

smbclient //server/share -U domain\\username%password

(this will display your password in plaintext on the command line interface...and also in your shell history file)

ruebenramirez commented 6 years ago

if you want to umount a mounted volume, make sure that you cd out of the mounted dir on all your terminal sessions or you'll get a nice little error message:

target is busy                                                                                                                                                                    (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)
ruebenramirez commented 6 years ago
ruebenramirez commented 6 years ago
ruebenramirez commented 6 years ago

These permissions are probably too relaxed, but I was able to mount some windows storage and write to it as a non-root user by adding this line to the end of my /etc/fstab:

//host/share-name  /mnt/share-mount-directory  cifs  credentials=/home/user/.Smbcredentials,noperm,guest,uid=1000,iocharset=utf8  0  0