Mounting Samba (CIFS) Share
I started working at an organization that uses a Windows Samba share to share temporary files over the network.
To mount such a share, you need to mount a
cifs type like below:
USERNAME="programster" PASSWORD="putYourPasswordHere" USER_ID=1000 GROUP_ID=$USER_ID SAMBA_SERVER_IP="192.168.1.2" NAME_OF_SHARE="projects" MOUNT_PATH="/mnt/projects" sudo mount -t cifs \ -o username=$USERNAME,password=$PASSWORD,uid=$USER_ID,gid=$GROUP_ID \ //$SAMBA_SERVER_IP/$NAME_OF_SHARE \ $MOUNT_PATH
Read-Only Access Issue - Specify UID/GID
When I first looked into performing the mounting, I didn't specify the
gid parameters and only had read access (no write). After specifying the UID and GID of my user on my local machine
To find out your user ID, just run:
If you want to find the ID of another user, use:
id -u $USERNAME
- Unix And Linux - Mount cifs Network Drive: write permissions and chown
- Ask Ubuntu - How can I find my User ID (UID) from terminal?
First published: 17th October 2018