samba伺服器掛載訪問失敗
Q1:
[root@samba-client /]# mount.cifs -o user=stu,pass=123456 //192.168.221.129/share /stu1
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
1
2
3
4
掛載失敗,沒有許可權
A:
1、檢查掛載的文件夾是否有許可權(給與777測試),配置文件中分享的模塊是否給與用戶許可權?
2、更換掛載命令(懷疑是否是軟體版本問題導致命令不可用?)
mount -t cifs -o user=stu,pass=123456 //192.168.221.129/share /stu1
1
2
3、//192.168.221.129/share中的share是標籤名,而不是路徑,是否寫錯?
4、使用pdbedit -L 命令查看用戶是否加入samba伺服器?
結果發現用戶名寫錯了,所以掛載失敗·······
Q2:
再次掛載,又報錯
[root@samba-client /]# mount.cifs -o user=stu1,pass=123456 //192.168.221.129/share /stu1
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
1
2
3
4
目錄不存在?
A:
1、檢查文件夾及配置文件,是否設置錯誤,文件夾名是否寫錯?
2、 檢查共享文件列表
[root@samba-client /]# smbclient -L //192.168.221.129/
Enter root”s password:
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.9-164.el6]
Sharename Type Comment
——— —- ——-
devops Printer samba-server test
share Printer share
IPC$ IPC IPC Service (Samba Server Version 3.6.9-164.el6)
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.9-164.el6]
Server Comment
——— ——-
SAMBA-SERVER Samba Server Version 3.6.9-164.el6
Workgroup Master
——— ——-
MYGROUP SAMBA-SERVER
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
發現share的TYPE是Printer,又因為-o參數是指定磁碟的,懷疑是否是因為share的共享格式有問題。
3、檢查配置文件設置內容
[share]
297 comment =share
298 valid users =stu1
299 path = /tmp/samba/share
300 public = yes
301 writable = yes
302 browseable = yes
303 readonly = no
// 將printable = yes這個列印選項刪除
再次查看共享文件夾類型。
[root@samba-client /]# smbclient -L //192.168.221.129/
Enter root”s password:
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.9-164.el6]
Sharename Type Comment
——— —- ——-
devops Printer samba-server test
share Disk share
IPC$ IPC IPC Service (Samba Server Version 3.6.9-164.el6)
Anonymous login successful
發現share的TYPE選項變為了DISK
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
4、再次掛載
[root@samba-client /]# mount.cifs -o user=stu1,pass=123456 //192.168.221.129/share /stu1
//成功!
1
2
3
4
5、監測
[root@samba-client /]# mount.cifs -o user=stu1,pass=123456 //192.168.221.129/share /stu1
[root@samba-client /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_min1-lv_root 13G 1.6G 11G 14% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 485M 33M 427M 8% /boot
/dev/sr0 4.2G 4.2G 0 100% /mnt/dvd
//192.168.221.129/share 13G 1.3G 11G 11% /stu1
(reverse-i-search)`mount “: ^Cunt -t cifs -o user=test,pass=123456 //192.168.221.129/devops/test /samba
1
2
3
4
5
6
7
8
9
10
df -h可以查看到,掛載成功,已經可以使用了。