- Managing SMB File Sharing and Windows Interoperability in Oracle Solaris 11.4
- Using SMB File Sharing on Client Systems
- Managing SMB Mounts in Your Local Environment
- How to Mount an SMB Share on a Directory You Own
How to Mount an SMB Share on a Directory You Own
Note:
If you own the directory on which you want to mount a share, you can perform the mount operation yourself. If you do not own the directory, you must perform the mount operation as the owner of the directory or as superuser.- Verify that the
network/smb/clientservice is enabled.$ svcs network/smb/client STATE STIME FMRI online 19:24:36 svc:/network/smb/client:defaultThis service is enabled by default, so the usual state for the service is
online. To enable the service, type the following command:$ svcadm enable -r network/smb/client - Find the share that you want to mount from a server.
$ smbadm show-shares [-A | -u username] [-t] server-
-A -
Enables you to view shares anonymously
-
-u -
Indicates the user to authenticate on the specified SMB server
-
-t -
Displays a heading for the output
If neither the
-Anor the-uoption is specified, the user that is running the command is authenticated on the SMB server. -
- Create a mount point on which to mount the share.
$ mkdir mount-pointFor example, to create a mount point called
/tmp/mnt, type:$ mkdir /tmp/mnt - Perform the mount on your directory.
$ mount -F smbfs [-o dirperms=octal-triplet,fileperms=octal-triplet,gid=group-ID,\ uid=user-ID,user=username,...] //server/share mount-pointFor example, to mount the
tmpshare from thesolarsystemserver on the/tmp/mntmount point, type:$ mount -F smbfs //solarsystem/tmp /tmp/mntYou can use the following options to set the directory access permissions in the client:
-
dirperms=octal-triplet – Specifies the directory permissions that you can set to the directories. Thedirpermspermission does not affect the access policies that the SMB server maintains. By default, the system uses the value that you set for thefileperms. The system then addsexecutepermissions to thefilepermssettings.For example, you can set
dirpermsto700to prevent group members from accessing the directory.$ ls -ld /export/home/user1/mnt drwxr-xr-x 2 user1 staff 2 Dec 16 13:57 /export/home/user1/mnt $ mount - F smbfs -o dirperms=770 //server/share /export/home/user1/mnt $ su - user2 user2% gid -gn staff user2% ls -ld /export/home/user1/mnt/test drwxrwx---+ 1 user1 staff 512 Aug 27 14:58 /export/home/user1/mnt/test user2% exit $ umount /export/home/user1/mnt $ mount - F smbfs -o dirperms=700 //server/share /export/home/user1/mnt $ su -user2 user2% ls -ld /export/home/user1/mnt/test /export/home/user1/mnt/test:Permission denied
-
fileperms=octal-triplet – Specifies the file permissions that you can set to the files on a mount point. Thefilepermspermission does not affect the access policies that the SMB server maintains. By default, the file permission is700.For example, you can set
filepermsto770to enable the group associated with the mount point to access files on the mount point.$ ls -ld /export/home/user1/mnt drwxr-xr-x 2 user1 staff 2 Dec 16 13:57 /export/home/user1/mnt $ mount - F smbfs //server/share /export/home/user1/mnt $ su - user2 user2% gid -gn staff user2% ls -l /export/home/user1/mnt/test.file /export/home/user1/mnt/test.file: Permission denied user2% exit $ umount /export/home/user1/mnt $ mount - F smbfs -o fileperms=770 //server/share /export/home/user1/mnt $ su - user2 user2% ls -l /export/home/user1/mnt/test.file -rwx------+ 1 user1 staff 0 Dec 16 15:56 /tmp/mnt/test.file
-
gid=group-ID – Specifies the group ID that you can set as the effective group. The effective group uses the group permissions that is set for the mount point. By default, the value ofgidis the group ID of the mount point.The following example shows that the group ownership of the mount point
/export/home/user1/mntis set tostaff. You can set thegidtonot_staffto enable the users in thenot_staffgroup to access the files on the mount point.$ ls -ld /export/home/user1/mnt drwxr-xr-x 2 user1 staff 2 Dec 16 13:57 /export/home/user1/mnt $ mount -F smbfs -o dirperms=770 //server/share /export/home/user1/mnt $ su -user2 user2% gid -gn not_staff user2% ls -ld /export/home/user1/mnt/test /export/home/user1/mnt/test: Permission denied user2% exit $ umount /export/home/user1/mnt $ mount -F smbfs -o gid=not_staff,dirperms=770 //server/share /export/home/user1/mnt $ su - user2 user2% ls -ld /export/home/user1/mnt/test drwxr-x---+ 1 user1 staff 512 Dec 16 15:56 /tmp/mnt/test
-
uid=user-ID – Specifies the local user ID that you can set as the effective owner. The effective owner uses the owner permissions that is set for the mount point. By default, the value ofuidis the user ID of the mount point.For example, to enable
user2to access the mounted files, you can setuidtouser2.$ ls -ld /export/home/user1/mnt drwx------ 2 user1 staff 2 Dec 16 13:57 /export/home/user1/mnt $ mount - F smbfs //server/share /export/home/user1/mnt $ su - user2 user2% ls -ld /export/home/user1/mnt/test /export/home/user1/mnt/test: Permission denied user2% exit $ umount /export/home/user1/mnt $ mount - F smbfs -o uid=user2 //server/share /export/home/user1/mnt $ su - user2 user2% ls -ld /export/home/user1/mnt/test drwxr-x---+ 1 user1 staff 512 Dec 16 15:56 /tmp/mnt/test
-