Skip to content

Instantly share code, notes, and snippets.

@alimbada
Last active September 11, 2025 14:48
Show Gist options
  • Select an option

  • Save alimbada/954dc9de4f90f3c8b27a43e23c86b786 to your computer and use it in GitHub Desktop.

Select an option

Save alimbada/954dc9de4f90f3c8b27a43e23c86b786 to your computer and use it in GitHub Desktop.

Revisions

  1. alimbada revised this gist Sep 11, 2025. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions SMB.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,8 @@
    #### Mount SMB share as non-root user with write permissions

    ```sh
    sudo mount -t cifs -o "uid=$local_user,username=$smb_user,addr=$host,vers=1.0" //$host/$share $mount_path
    sudo mount -t cifs -o "uid=$local_user,username=$smb_user,addr=$host" //$host/$share $mount_path
    ```
    > [!NOTE]
    >`vers=1.0` only applies because I have a very old NAS running SMB 1.0. <br>
    > Yes, it's insecure. No, it can't be updated. Yes, it's in the process of being retired.

    For errors:

  2. alimbada revised this gist Feb 11, 2025. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion SMB.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,10 @@ sudo mount -t cifs -o "uid=$local_user,username=$smb_user,addr=$host,vers=1.0" /
    >`vers=1.0` only applies because I have a very old NAS running SMB 1.0. <br>
    > Yes, it's insecure. No, it can't be updated. Yes, it's in the process of being retired.
    #### For error: mount: $mount_path: cannot mount //$host/$share read-only
    For errors:

    * `mount: $mount_path: cannot mount //$host/$share read-only`
    * `mount: $mount_path: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.`

    Install `cifs-utils`:

  3. alimbada revised this gist Jan 30, 2025. 2 changed files with 16 additions and 4 deletions.
    16 changes: 16 additions & 0 deletions SMB.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #### Mount SMB share as non-root user with write permissions

    ```sh
    sudo mount -t cifs -o "uid=$local_user,username=$smb_user,addr=$host,vers=1.0" //$host/$share $mount_path
    ```
    > [!NOTE]
    >`vers=1.0` only applies because I have a very old NAS running SMB 1.0. <br>
    > Yes, it's insecure. No, it can't be updated. Yes, it's in the process of being retired.
    #### For error: mount: $mount_path: cannot mount //$host/$share read-only

    Install `cifs-utils`:

    ```sh
    sudo apt install cifs-utils
    ```
    4 changes: 0 additions & 4 deletions non-root-smb-mount.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +0,0 @@
    # vers=1.0 only applies because I have a very old NAS running SMB 1.0.
    # Yes, it's insecure. No, it can't be updated. Yes, it's in the process of being retired.

    sudo mount -t cifs -o "uid=$LOCAL_USER,username=$SMB_USER,addr=$HOST,vers=1.0" //$HOST/$SHARE $MOUNT_PATH
  4. alimbada revised this gist Jan 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion non-root-smb-mount.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # vers=1.0 only applies because I have a very old NAS running SMB 1.0.
    # Yes, it's insecure. No, it can't be updated. Yes, it's in the process of being retired.

    sudo mount -t cifs -o "uid=$LOCAL_USER,username=$SMB_USER,addr=$HOST,vers=1.0" //$HOST/$SHARE /$MOUNT_PATH
    sudo mount -t cifs -o "uid=$LOCAL_USER,username=$SMB_USER,addr=$HOST,vers=1.0" //$HOST/$SHARE $MOUNT_PATH
  5. alimbada created this gist Jan 30, 2025.
    4 changes: 4 additions & 0 deletions non-root-smb-mount.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # vers=1.0 only applies because I have a very old NAS running SMB 1.0.
    # Yes, it's insecure. No, it can't be updated. Yes, it's in the process of being retired.

    sudo mount -t cifs -o "uid=$LOCAL_USER,username=$SMB_USER,addr=$HOST,vers=1.0" //$HOST/$SHARE /$MOUNT_PATH