access windows shared dir from linux

Access Windows Shares from Linux

by Vivek Gite on November 26, 2006 · 20 comments

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值