$ svcs network/smb/client STATE STIME FMRI online 19:24:36 svc:/network/smb/client:default
This 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
$ smbadm show-shares [-A | -u username] [-t] server
Enables you to view shares anonymously
Indicates the user to authenticate on the specified SMB server
Displays a heading for the output
If neither the –A nor the –u option is specified, the user that is running the command is authenticated on the SMB server.
$ mkdir mount-point
For example, to create a mount point called /tmp/mnt, type:
$ mkdir /tmp/mnt
$ mount -F smbfs [-o dirperms=octal-triplet,fileperms=octal-triplet,gid=group-ID,\ uid=user-ID,user=username,...] //server/share mount-point
For example, to mount the tmp share from the solarsystem server on the /tmp/mnt mount point, type:
$ mount -F smbfs //solarsystem/tmp /tmp/mnt
You 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. The dirperms permission does not affect the access policies that the SMB server maintains. By default, the system uses the value that you set for the fileperms. The system then adds an execute permission to the fileperms settings.
For example, you can set dirperms to 700 to 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. The fileperms permission does not affect the access policies that the SMB server maintains. By default, the file permission is 700.
For example, you can set fileperms to 770 to 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 of gid is the group ID of the mount point.
The following example shows that the group ownership of the mount point /export/home/user1/mnt is set to staff. You can set the gid to not_staff to enable the users in the not_staff group 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 of uid is the user ID of the mount point.
For example, to enable user2 to access the mounted files, you can set uid to user2.
# 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