Copy files to an SMB share as non-root user

6,171

Either you add a mount option

mount.cifs //192.168.1.1/share ~/share/ -o rw username=XYXY,password=XYXYXY

or you write a textfile

gedit ~/.smbcredentials

with the content:

username=XYXY

password=XYXYXY

After that type

sudo chmod 600 ~/.smbcredentials

Now try mounting:

mount.cifs //192.168.1.1/share ~/share/ -o rw credentials=~/.smbcredentials

For reference: http://forums.buffalotech.com/t5/Storage/Instructions-mount-Linkstation-shares-on-Linux-system-Ubuntu/td-p/63306

Share:
6,171
ccman
Author by

ccman

Updated on September 18, 2022

Comments

  • ccman
    ccman over 1 year

    I would like to access and copy some files to an SMB share. These commands work with sudo, no username/password is needed:

    mount.cifs //192.168.1.1/share ~/share/ -o rw
    cp *pdf share/
    umount share/
    

    Is there a way to do this as non-root user?