快速配置 Samba 將 Linux 目錄映射為 Windows 驅動器


原文鏈接

samba client

ubuntu

redhat

ubuntu gui tools


 1,列出某個IP地址所提供的共享文件夾 
smbclient -L 198.168.0.1

 
2,在security=share模式下訪問一個匿名可以訪問的目錄
smbclient //192.168.0.1/目錄名

3,像FTP客戶端一樣使用smbclient 
smbclient //192.168.0.1/tmp  -U username%password 

4,例,創建一個共享文件夾 
smbclient -c "mkdir share1"  //192.168.0.1/tmp  -U username%password 
如果用戶共享//192.168.0.1/tmp的方式是只讀的,會提示 
NT_STATUS_ACCESS_DENIED making remote directory \share1 
5,除了使用smbclient,還可以通過mount和smbcount掛載遠程共享文件夾 
mount -t smbfs -o  username=administrator,password=123456 //192.168.0.1/tmp  /mnt/tmp 
# mount -t smbfs -o username="administrator",password="" //192.168.1.100/cp /mnt/ntfs

提示出錯:
mount: unknown filesystem type 'smbfs'

查資料后,說smbfs改為cifs了,所以要用下面的方法:

# mount -t cifs -o username="administrator",password="" //192.168.1.101/cp /mnt/ntfs

成功!!


smbmount //192.168.0.1/tmp /mnt/tmp -o username=administrator

訪問目錄:


 

ubuntu

一. Samba的安裝:

# sudo apt-get insall samba

# sudo apt-get install smbfs

二. 創建共享目錄:

# mkdir /home/willis/share

# sodu chmod 777 /home/willis/share

三. 創建Samba配置文件:

1. 保存現有的配置文件

# sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

2. 創建新的Samba配置文件

# sodu vim /etc/samba/smb.conf

; ############### smb.conf #######################

[global]

    ; 創建工作組   

    workgroup = MYGROUP

    ; 安全模式, 我們設置最低安全級別

    security = share

    ; 是否允許guest用戶訪問

    guest ōk = yes

[share]

    ; 共享文件夾路徑

    path = /home/willis/share

    ; 讀權限

    browseable = yes

    ; 寫權限

    writeable = yes

四. 測試文件配置結果

# testparm

五. 重啟Samba服務

# /etc/init.d/smbd restart

六. 退出重新登陸或者重啟機器

七. 測試登陸

# smbclient -L //localhost/share

從遠程的機子上測試:

# smbclient  //<samba_server_ip>/share

成功咯! :-)

八. 參考資料

Ubuntu中設置samba共享可讀寫文件夾:
http://forum.ubuntu.org.cn/about20852.html&highlight=samba
http://wiki.ubuntu.org.cn/Samba

 原文鏈接

 一、局域網內的 Linux 服務器上操作步驟:

  1、安裝samba(CentOS Linux):

yum install samba system-config-samba samba-client samba-common



  2、創建www賬號

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www

mkdir -p /data0/knose/
chmod 777 /data0/knose/

mkdir -p /data0/htdocs/
chown -R www:www /data0/htdocs/
chmod 777 /data0/htdocs/

cat /etc/passwd | mksmbpasswd.sh> /etc/samba/smbpasswd



  3、創建samba配置文件

mv -f /etc/samba/smb.conf /etc/samba/smb.conf.bak
vi /etc/samba/smb.conf


  輸入以下內容:

引用
[global]
server string = Samba Server
security = user
encrypt passwords = yes 
smb passwd file = /etc/samba/smbpasswd

[knose]
workgroup = root
netbios name = root
path = /data0/knose
browseable = yes
writeable = yes

[web]
workgroup = www
netbios name = www
path = /data0/htdocs
browseable = yes
writeable = yes



  4、為samba用戶www、root設立一個密碼:

smbpasswd -a www
smbpasswd -a root



  5、啟動samba:

/sbin/service smb start





  二、局域網內的 Windows 服務器上操作步驟:

  1、Windows 上訪問 samba,在“我的電腦”中輸入:

\\xxx.xxx.xxx.xxx\



  2、Windows 斷開 samba 共享連接,在【開始】→【運行】→【cmd】回車中輸入:

net use * /del



  3、將 samba 共享的 Linux 目錄,映射成 Windows 的一個驅動器盤符:

  點擊在新窗口中瀏覽此圖片

  點擊在新窗口中瀏覽此圖片

  點擊在新窗口中瀏覽此圖片



  三、跨平台C/C++代碼編譯、調試:

  用 Windows 下的編輯器編寫、修改跨平台的C/C++代碼,保存后,無需復制到其他地方,即可同時用 Windows 下的 Visual Studio,Linux 下的 g++、gcc、gdb,編譯、調試程序了。

  點擊在新窗口中瀏覽此圖片

  點擊在新窗口中瀏覽此圖片

  注意:在samba共享的驅動器上執行“.bat”批處理腳本,會導致 Windows 藍屏,這一點需要注意。


 原文:http://www.unixmen.com/how-to-configure-samba-using-a-graphical-interface-in-ubuntu/

Installing Samba:

First thing we need to do is to install samba, go to Software center in Ubuntu and search for samba then install the package. If you want to install it via terminal then copy this command :

sudo apt-get  install  samba samba-common

Installing Samba Server configuration Tool:

Now install the graphical interface System-config samba

sudo apt-get install system-config-samba

Configuration of samba using a graphical interface:

Now we will try for example to share the directory  /home/pirat9/share folder to do that,

First open GUI samba  server configuration tool by going to System–> Administration–>Samba

Add the  folder you want to share and setup the permissions access.

Now  right click on the  folder directory you want to share and open the  share  options

Then select share this folder

If you want to setup folder access permissions, right click on the folder and open properties (See screenshot bellow)

 

If you want to add a password to the user: open a terminal and type the command  :

sudo  smbpasswd  -a pirat9

and  then type your password.

Now the configuration is done.

Now lets try to check if we can for example connect from a windows machine. To do that

In a windows machine go to start –>Run and type :

 ip  or  hostname

 

 

You will be asked to insert the user and password

Check the  share  folder

And is done.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM