Chinaunix首页 | 论坛 | 博客
  • 博客访问: 163457
  • 博文数量: 15
  • 博客积分: 2015
  • 博客等级: 大尉
  • 技术积分: 630
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-01 09:11
文章分类

全部博文(15)

文章存档

2011年(2)

2010年(8)

2009年(1)

2008年(4)

我的朋友
最近访客

分类: LINUX

2010-10-28 10:28:46

Access Windows Shares from Linux

Q. How do I Access Windows share from Linux command prompt? I would like to be able to access shared folders on Windows machines from my Linux system.

A. There are two ways. Use command line tool called smbclient or you can mount windows shares the mount command. Another option is use GUI tools. Please refer previous articles about access windows share from Linux:

( a ) Mount Windows share using mount command

This is simple way to share data between windows and linux system. You would like to access MS-Windows share called //windowsserver/sharename by mounting to /mnt/win directory under Linux system. Type the following command (replace username, windows server name, share name and password with actual values):

# mkdir -p /mnt/win
# mount -t smbfs -o username=winntuser,password=mypassword //windowsserver/sharename /mnt/win
# cd /mnt/win
# ls -l


For the share //windowsserver/sharename to be automatically mounted at every system start (after reboot), insert an option in the file /etc/fstab:

# vi /etc/fstab


Append following line (written in a single line)

//windowserver/share /mnt/win smbfs
auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0


Next create the password file /etc/sambapasswords:

vi /etc/sambapasswords


Now add following content:

username = winntuser
password = mypassword


Save and close the file. Make sure only root can access your file:

# chown 0.0 /etc/sambapasswords
# chmod 600 /etc/sambapasswords

  • -t smbfs : File system type to be mount (outdated, use cifs)
  • -t cifs : File system type to be mount
  • -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
  • //windowserver/share : Windows 2000/NT share name
  • /mnt/win Linux mount point (to access share after mounting)

阅读(1251) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-10-28 18:01:02

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com