二:将windows 2003作为服务器,linux作为客户端
使用user3 访问共享的资源
[root@ samba]# smbclient //192.168.1.201/share -U user3
Password:
Domain=[ZZU-2003] OS=[Windows Server 2003 3790 Service Pack 1] Server=[Windows Server 2003 5.2]
smb: \> dir
. D 0 Sat Apr 14 13:41:39 2012
.. D 0 Sat Apr 14 13:41:39 2012
123124.txt A 0 Sat Apr 14 13:41:34 2012
65452 blocks of size 131072. 48142 blocks available
smb: \> get 123124.txt
getting file \123124.txt of size 0 as 123124.txt (0.0 kb/s) (average 0.0 kb/s)
smb: \> !dir
123124.txt 192.168.1.201.log cores nmbd.log smbd.log zzu-2003.log
映射到本地
[root@ tmp]# mkdir /mnt/smb
[root@ samba]# mount -t cifs -o username=user3,password='123' //192.168.1.201/share /mnt/smb
[root@ samba]# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hdc on /media/RHEL_5.4 i386 DVD type iso9660 (ro,noexec,nosuid,nodev,uid=0)
/dev/hdc on /mnt/cdrom type iso9660 (ro)
//192.168.1.201/share on /mnt/smb type cifs (rw,mand)
[root@ samba]#vim /etc/fstab
//192.168.1.201/share /mnt/smb cifs defaults,username=user3,password=123 0 0
[root@ samba]# umount /mnt/smb/
[root@ samba]# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hdc on /media/RHEL_5.4 i386 DVD type iso9660 (ro,noexec,nosuid,nodev,uid=0)
/dev/hdc on /mnt/cdrom type iso9660 (ro)
[root@ samba]# mount -a
[root@ samba]# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hdc on /media/RHEL_5.4 i386 DVD type iso9660 (ro,noexec,nosuid,nodev,uid=0)
/dev/hdc on /mnt/cdrom type iso9660 (ro)
//192.168.1.201/share on /mnt/smb type cifs (rw,mand)
由于fstab文件每一个账号都可以查看,为了增加安全性,我们做一下的修改
[root@ samba]#vim /etc/fstab
//192.168.1.201/share /mnt/smb cifs defaults, credentials=/etc/samba/account.txt 0 0
[root@ samba]vim /etc/samba/account.txt
Username=user3
Password=123
[root@ samba]chmod 600 /etc/samba/account.txt
[root@ ~]# ll /etc/samba/account.txt
-rw------- 1 root root 28 Apr 14 18:14 /etc/samba/account.txt