Changes

Linux CIFS Utils and Samba

2,797 bytes added, 06:27, 14 June 2021
/* Accessing Windows Shares: Discussion */
The following lines were added (+) and removed (-):
Another example for a modern NAS sudo mount -t cifs -o user=nicolep,uid=1001 //apollo/documents /mnt/documents''She will be prompted for a password when she executes this command for sudo, and again for the SMB account password for her account nicolep.  Also, the uid is set matching her local account in /etc/passwd so that the mounted share does not appear with all files and directories as owner root, thus they would have not been writable to her.''error: mount.cifs: bad UNC (/apollo/documents)  <- if you are getting this error make sure you have two forward slashes on the path //apolloUnmount when done sudo umount //apollo/nicolep#Using the mount command in a script (which prompts user for password when executed)HIGHLY RECOMMENDED - As a means to mount NAS and network shares without having to edit fstab or hard coding passwords.  More reliable than file manager tools like the one in Nautilus.RECOMMENDED - As a means to mount NAS and network shares without having to edit fstab or hard coding passwords.  More reliable than file manager tools like the one in Nautilus.The autofs filesystem module is only one part of an autofs system. There also needs to be a user-space program which looks up names and mounts filesystems. This will often be the "automount" program, though other tools including systemd can make use of autofs. Then autofs is a Linux kernel module with provides the autofs ilesystem type.  Auto-mounts are mounted only as they are accessed, and are unmounted after a period of inactivity. Because of this, automounting NFS/Samba shares conserves bandwidth and offers better overall performance compared to static mounts via fstab.#automount is the program used to configure a mount point for autofs. When autofs is started, an automount daemon is spawned for each map.#Auto-mount or auto-mounting refers to the process of automatically mounting filesystems.#autofs is the program that controls the operation of the automount daemons.  Install the autofs package either by clicking here or entering the following in a terminal window: sudo apt install autofsTo configure autofs you will need to edit configuration files.  The master configuration file for autofs is /etc/auto.master by default. When specifying a CIFS share in a map file, specify -fstype=cifs and precede the share location with a colon (:). mntpoint -fstype=cifs ://example.com/shrnameExample: Mount read-write, specifying a user and group to own the files: mntpoint -fstype=cifs,rw,uid=myuserid,gid=mygrpid ://example.com/shrnameExample: Mount read-write, specifying a username and password to use to connect to the share: mntpoint -fstype=cifs,rw,username=myuser,password=mypass ://example.com/shrname=== mount via a shell script ===A method of using the mount command in a shell script which will prompt the user for passwords.  Doing this in a startup script will require some method of timeout as it could hold up system loading final.Better to have a command to launch script when shares are neededBased on executing the mount command in this fashion sudo mount -t cifs -o username=nicolep //servername/public /mnt/public
Bureaucrat, administrator
16,192
edits