Mounting Samba and Copy File

Posted on

This article happen to be another series and the continuity of the previous article discussed about samba service usage. One of the article titled ‘Samba Access Error session setup failed NT_STATUS_LOGON_FAILURE’ which can be found in this link, providing an information on accessing samba sharing definition by resolving the error specified. Another article which is focusing on how to copy file from across file and folder sharing definition is described in article titled ‘Copy file from Linux to Windows file and folder sharing’ and it can be visited in this link.

Basically, there is a clear and solid difference on the samba configuration provided in the article presented with the title of ‘Samba Access Error session setup failed NT_STATUS_LOGON_FAILURE’ recorded in this link with the one presented in this article which is normally located in /etc/samba/smb.conf. That line is the following :

security = user 

This is one of the two types of security available in samba service. One of the type is given above which is indicated with the keyword ‘security’ parameter defined which is the ‘user’ type. So, the the first type is the ‘user’ type and the latter is the ‘sharing’ type.

The ‘user’ type is the simplest type where the connection made doesn’t check every sharing permission available for every specific access made by any user.

The ‘sharing’ mode is quite different. It will treat every user connect differently if the sharing folder or files accessed are different. In other means, there are specific permission attribute defined for each folder sharing.

Another thing which is triggered this article to be written is the previous article which is also discussing about samba in the article titled ‘Add Samba User in Linux with smbpasswd’ in this link.

Precisely using this ‘user’ type security, by using the available user account on the system, any defined sharing folder with their default configuration or files in samba configuration files can beĀ  accessed and mounted by executing the following command :

mount -t cifs // /mnt -o username=user,password=passwd

The above command pattern is executed as follows for giving further example :

[root@hostname mnt]# mount -t cifs // /mnt -o username=myself,password=mypassword
[root@hostname mnt]# 

The above command execution must be precisely accurate especially the folder name of the mount point destination, the shared name and the IP Address providing the shared folder and also the username and also the password given. If the mounting process has already successfully executed, the mount point list of the previous command execution will be displayed upon executing the command ‘mount’ as shown below :

[root@hostname mnt]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=65981176k,nr_inodes=16495294,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
/dev/mapper/centos_noc01-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=33,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
/dev/sda2 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/mapper/centos_01-var on /var type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
/dev/mapper/centos_01-tmp on /tmp type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/mapper/centos_01-var_log on /var/log type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/mapper/centos_01-var_log_audit on /var/log/audit type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=13205272k,mode=700)
// on /mnt type cifs (rw,relatime,vers=1.0,cache=strict,username=myself,domain=DEV,uid=0,noforceuid,gid=0,noforcegid,addr=,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)
[root@hostname mnt]

The mount point is shown in the line above :

// on /mnt type cifs (rw,relatime,vers=1.0,cache=strict,username=myself,domain=DEV,uid=0,noforceuid,gid=0,noforcegid,addr=,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)

If the folder is writable, by default the copy process can be executed like the copy process performed in local harddisk. Since the folder and file sharing is mounted, it will be treated just as a local resource.

One thought on “Mounting Samba and Copy File

Leave a Reply