Instalando e configurando o serviço
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
[root@centos]# yum install samba samba-client samba-common [root@centos]# systemctl enable nmb smb [root@centos]# adduser jhones [root@centos]# passwd jhones [root@centos]# groupadd samba [root@centos]# usermod jhones -aG samba [root@centos]# chmod 0770 /storage/ [root@centos]# chown root.samba /storage/ [root@centos]# vim /etc/samba/smb.conf # See smb.conf.example for a more detailed config file or # read the smb.conf manpage. # Run 'testparm' to verify the config is correct after # you modified it. [global] workgroup = SAMBA security = user passdb backend = tdbsam map to guest = bad user printing = cups printcap name = cups load printers = yes cups options = raw #[homes] # comment = Home Directories # valid users = %S, %D%w%S # browseable = No # read only = No # inherit acls = Yes #[print$] # comment = Printer Drivers # path = /var/lib/samba/drivers # write list = root # create mask = 0664 # directory mask = 0775 [opt] path = /opt valid users = root guest ok = no writable = yes browsable = yes create mask = 666 directory mask = 777 force directory mode = 0777 force create mode = 0777 [storage] path = /storage valid users = @samba guest ok = no writable = yes browsable = yes create mask = 666 directory mask = 777 force directory mode = 0777 force create mode = 0777 [root@centos]# systemctl start nmb smb [root@centos]# smbpasswd -a jhones [root@centos]# testparm |
Cliente no Linux MODO1
1 2 |
[root@centos]# yum install cifs-utils [root@centos]# mount.cifs //192.168.1.15/storage /mnt/storage -o username=jhones,password=123456 |
Cliente no Linux MODO2
1 2 3 4 5 6 |
[root@centos]# vim /etc/.storage username=jhones password=123456 [root@centos]# chmod 600 /etc/.storage [root@centos]# mount -t cifs //192.168.1.15/storage /mnt/storage -o credentials=/etc/.storage |
E no /etc/fstab
1 |
//192.168.1.15/storage /mnt/storage cifs credentials=/etc/.storage,defaults 0 0 |