當前位置:首頁 » 操作系統 » linux虛擬機傳文件

linux虛擬機傳文件

發布時間: 2024-05-26 07:15:01

㈠ 鎬庝箞鎶婃湰鍦扮殑鏂囦歡浼犲埌linux鉶氭嫙鏈轟腑

濡傛灉鏄疺M
1 鍙浠ヤ綔涓涓猉P鍏變韓
2 鍙浠ュ湪linux浣滀竴涓猻amba鏈嶅姟
鍦ㄧ墿鐞嗘満涓婅繍琛屼腑鎵//(linuxIP)灝辮兘涓婁紶

娉曞瓙
1 Samba 綆浠

Samba錛圫MB鏄鍏剁緝鍐欙級 鏄涓涓緗戠粶鏈嶅姟鍣錛岀敤浜嶭inux鍜學indows鍏變韓鏂囦歡涔嬬敤錛汼amba 鍗沖彲浠ョ敤浜嶹indows鍜孡inux涔嬮棿鐨勫叡浜鏂囦歡錛屼篃涓鏍風敤浜嶭inux鍜孡inux涔嬮棿鐨勫叡浜鏂囦歡錛涗笉榪囧逛簬Linux鍜孡inux涔嬮棿鍏變韓鏂囦歡鏈夋洿濂界殑緗戠粶鏂囦歡緋葷粺NFS錛孨FS涔熸槸闇瑕佹灦璁炬湇鍔″櫒鐨勶紱

澶у剁煡閬撳湪Windows 緗戠粶涓鐨勬瘡鍙版満鍣ㄥ嵆鍙浠ユ槸鏂囦歡鍏變韓鐨勬湇鍔″櫒錛屼篃鍙浠ュ悓鏄瀹㈡埛鏈猴紱Samba 涔熶竴鏍瘋兘琛岋紝姣斿備竴鍙癓inux鐨勬満鍣錛屽傛灉鏋朵簡Samba Server 鍚庯紝瀹冭兘鍏呭綋鍏變韓鏈嶅姟鍣錛屽悓鏃朵篃鑳藉仛涓哄㈡埛鏈烘潵璁塊棶鍏跺畠緗戠粶涓鐨刉indows鍏變韓鏂囦歡緋葷粺錛屾垨鍏跺畠Linux鐨凷abmba 鏈嶅姟鍣錛

鎴戜滑鍦╓indows緗戠粶涓錛岀湅鍒板叡浜鏂囦歡鍔熻兘鐭ラ亾錛屾垜浠鐩存帴灝卞彲浠ユ妸鍏變韓鏂囦歡澶瑰綋鍋氭湰鍦扮‖鐩樻潵浣跨敤銆傚湪Linux鐨勪腑錛屽氨鏄閫氳繃Samba鐨勫悜緗戠粶涓鐨勬満鍣ㄦ彁渚涘叡浜鏂囦歡緋葷粺錛屼篃鍙浠ユ妸緗戠粶涓鍏跺畠鏈哄櫒鐨勫叡浜鎸傝澆鍦ㄦ湰鍦版満涓婁嬌鐢錛涜繖鍦ㄤ竴瀹氭剰涔変笂璇村拰FTP鏄涓嶄竴鏍風殑銆

Samba 鐢ㄧ殑netbios鍗忚錛屽傛灉鎮ㄧ敤Samba 涓嶆垚鍔燂紝

Linux涓嶹indows 銆丩inux 鍜 Linux

2 Samba 鍔熻兘鍜屽簲鐢ㄨ寖鍥

Samba 搴旇ヨ寖鍥翠富瑕佹槸Windows鍜孡inux 緋葷粺鍏卞瓨鐨勭綉緇滀腑浣跨敤錛涘傛灉涓涓緗戠粶鐜澧冮兘鏄疞inux鎴朥nix綾葷殑緋葷粺錛屾病鏈夊繀瑕佺敤Samba錛屽簲璇ョ敤NFS鏇村ソ涓鐐癸紱

閭Samba 鑳戒負鎴戜滑鎻愪緵鐐逛粈涔堟湇鍔″憿錛熶富瑕佹槸鍏變韓鏂囦歡鍜屽叡浜鎵撳嵃鏈猴紱

3 Samba 涓や釜鏈嶅姟鍣ㄧ浉鍏沖惎鍔ㄧ▼搴忋佸㈡埛絝鍙婃湇鍔″櫒閰嶇疆鏂囦歡絳夛紱

3.1 Samba 鏈変袱涓鏈嶅姟鍣錛屼竴涓鏄痵mb錛屽彟涓涓鏄痭mb錛

smb 鏄瘲amba 鐨勪富瑕佸惎鍔ㄦ湇鍔″櫒錛岃╁叾瀹冩満鍣ㄨ兘鐭ラ亾姝ゆ満鍣ㄥ叡浜浜嗕粈涔堬紱濡傛灉涓嶆墦寮nmb鏈嶅姟鍣ㄧ殑璇濓紝鍙鑳介氳繃IP鏉ヨ塊棶錛屾瘮濡傚湪Windows鐨処E嫻忚堝櫒涓婃墦鍏ヤ笅闈㈢殑涓鏉℃潵璁塊棶錛

\\192.168.1.5\鍏變韓鐩褰
\\192.168.1.5\opt

鑰宯mb鏄瑙f瀽鐢ㄧ殑錛岃В鏋愪簡浠涔堝憿錛熷氨鏄鎶婅繖鍙癓inux鏈哄櫒鎵鍏變韓鐨勫伐浣滅粍鍙婂湪姝ゅ伐浣滅粍涓嬬殑netbios name瑙f瀽鍑烘潵錛

涓鑸鐨勬儏鍐典笅錛屽湪RPM鍖呯殑緋葷粺錛屽傛灉鏄鐢≧PM鍖呭畨瑁呯殑Samba 錛屼竴鑸鍙浠ラ氳繃濡備笅鐨勬柟寮忔潵鍚鍔⊿amba鏈嶅姟鍣錛

[root@localhost ~]# /etc/init.d/smb start
鍚鍔 SMB 鏈嶅姟錛 [ 紜瀹 ]
鍚鍔 NMB 鏈嶅姟錛 [ 紜瀹 ]

濡傛灉鍋滄㈠憿錛熷氨鍦╯mb鍚庨潰鍔爏top 錛涢噸鍚灝辨槸restart

[root@localhost ~]# /etc/init.d/smb stop
[root@localhost ~]# /etc/init.d/smb restart

瀵逛簬鎵鏈夌郴緇熸潵璇達紝閫氱敤鐨勫姙娉曞氨鏄鐩存帴榪愯宻mb 鍜宯mb錛涘綋鐒舵偍瑕佺煡閬搒mb鍜宯mb鎵鍦ㄧ殑鐩褰曟墠琛岋紱濡傛灉鏄鑷宸辯紪璇戠殑Samba 錛屾偍搴旇ョ煡閬撴偍鎶奡amba鏀懼湪鍝閲屼簡錛

[root@localhost ~]# /usr/sbin/smbd
[root@localhost ~]# /usr/sbin/nmbd

鏌ョ湅鏈嶅姟鍣ㄦ槸鍚﹁繍琛岃搗鏉ヤ簡錛屽垯鐢ㄤ笅闈㈢殑鍛戒護錛

[root@localhost ~]# pgrep smbd
[root@localhost ~]# pgrep nmbd

鍏蟲帀Samba鏈嶅姟鍣錛屼篃鍙浠ョ敤涓嬮潰鐨勫姙娉曪紝澶у氭槸閫氱敤鐨勶紱瑕乺oot鏉冮檺鏉ユ墽琛岋紱

[root@localhost ~]# pkill smbd
[root@localhost ~]# pkill nmbd

3.2 鏌ョ湅Samba 鏈嶅姟鍣ㄧ殑絝鍙e強闃茬伀澧欙紱

鏌ョ湅榪欎釜鏈変綍鐢ㄥ憿錛熸湁鏃朵綘鐨勯槻鐏澧欏彲鑳戒細鎶妔mbd鏈嶅姟鍣ㄧ殑絝鍙e皝鎺夛紝鎵浠ユ垜浠搴旇smbd鏈嶅姟鍣ㄦ墍鍗犵敤鐨勭鍙o紱涓嬮潰鏌ョ湅涓錛屾垜浠鐭ラ亾smbd鎵鍗犵敤鐨勭鍙f槸139鍜445 錛

[root@localhost ~]# netstat -tlnp |grep smb
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 10639/smbd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 10639/smbd

濡傛灉鎮ㄦ湁闃茬伀澧欙紝涓瀹氳佹妸榪欎袱涓絝鍙f墦寮銆傚傛灉涓嶇煡閬撴庝箞鎵撳紑銆傚彲鑳戒綘鍜屾垜涓鏍鋒槸鏂版墜錛岃繕鏄鎶婇槻鐏澧欒勫垯娓呮帀涔熻岋紱

[root@localhost ~]# iptables -F

[root@localhost ~]# /sbin/iptables -F

3.3銆佹煡鐪婼amba 鏈嶅姟鍣ㄧ殑閰嶇疆鏂囦歡錛

濡傛灉鎴戜滑鏄鐢↙inux鍙戣岀増鑷甯︾殑Samba杞浠跺寘錛屼竴鑸鎯呭喌涓婼amba鏈嶅姟鍣ㄧ殑閰嶇疆鏂囦歡閮戒綅浜/etc/samba鐩褰曚腑錛屾湇鍔″櫒鐨勪富閰嶇疆鏂囦歡鏄痵mb.conf錛涗篃鏈夋湁鎴烽厤緗鏂囦歡 smbpasswd銆乻mbusers鍜宭mhosts絳夛紙鏈濂芥偍鏌ョ湅涓涓嬭繖浜涙枃浠剁殑鍐呭癸級錛涜繕鏈変竴涓鏂囦歡鏄痵ecrets.tdb錛岃繖涓鏂囦歡鏄瘲amba 鏈嶅姟鍣ㄥ惎鍔ㄦ墜鑷鍔ㄧ敓鎴愮殑錛涙垜浠鎱㈡參鏍規嵁鏁欑▼鐨勮繘搴︽潵閫傚綋鍦板炲姞榪欎簺鏂囦歡鐨勮存槑鍚э紱涓涓嬪瓙閮借村嚭鏉ワ紝鎰熻夊唴瀹瑰お澶氾紱鎵浠ュ彧鑳戒竴鐐逛竴鐐圭殑鏉ヤ簡錛

3.4銆丼amba 鍦↙inux 涓鐨勪竴浜涘伐鍏鳳紙鏈嶅姟鍣ㄧ鍜屽㈡埛絝錛夛紱

smbcacls smbcontrol smbencrypt smbmount smbprint smbstatus smbtree
smbclient smbcquotas smbmnt smbpasswd smbspool smbtar smbumount
smbd nmbd mount

鍏朵腑鏈嶅姟鍣ㄧ鐨勬槸smbd銆乶mbd銆乻mbpasswd 錛涘叾瀹冪殑澶у氭槸瀹㈡埛絝錛涜繖浜涘苟涓嶆槸閮介渶瑕佷竴瀹氳佺簿閫氱殑錛屼絾鑷沖皯寰椾細鐢ㄥ嚑涓錛涙瘮濡俿mbmount錛堜篃灝辨槸mount 鍔犲弬鏁扮殑鐢ㄦ硶錛夛紝榪樼敤smbclient絳夛紱

3.5 鍦↙inux 涓鐨勫父鐢ㄥ伐鍏穖ount錛坰mbmount錛夊拰smbclient錛沇indows鏌ョ湅Linux鍏變韓鐨勬柟娉 錛

3.5.1 鍦↙inux緋葷粺涓鏌ョ湅緗戠粶涓璚indows鍏變韓鏂囦歡鍙奓inux涓鐨凷amba鍏變韓鏂囦歡錛

涓鑸鐨勬儏鍐典笅錛屾垜浠瑕佺敤鍒皊mbclient錛涘父鐢ㄧ殑鐢ㄦ硶涔熸棤闈炴槸涓嬮潰鐨勶紱

[root@localhost ~]# smbclient -L //ip鍦板潃鎴栬$畻鏈哄悕

smbclient 鏄瘲amba 鐨凩inux 瀹㈡埛絝錛屽湪Linux鏈哄櫒涓婄敤鏉ユ煡鐪嬫湇鍔″櫒涓婄殑鍏變韓璧勬簮錛屼篃鍙浠ヨ薄FTP涓鏍鳳紝鐢ㄦ埛鍙浠ョ櫥褰昐amba鏈嶅姟鍣錛屼篃鍙浠ヤ笂浼爌ut鍜屼笅杞絞et鏂囦歡錛岄仐鎲劇殑鏄瀵逛腑鏂囨敮鎸佸苟涓嶅弸濂斤紱

鏌ョ湅鏈嶅姟鍣ㄤ笂鐨勮祫婧愶紱

smbclient -L //IP [-U 鐢ㄦ埛鍚峕

濡傛灉鎮ㄧ殑Samba鏈嶅姟鍣ㄩ厤緗涓簎ser妯″紡錛屽氨瑕佸姞 鈥-U 鐢ㄦ埛鍚嶁滐紝濡傛灉鏄痵hare妯″紡錛岀渷鐣ヤ篃鍙錛

姣斿傦細

[root@localhost ~]# smbclient -L //192.168.1.3 -U sir01
Password: 璇瘋緭鍏ョ敤鎴穝ir01鐨勫瘑鐮

濡傛灉鎮ㄦ槸鐢╯hare妯″紡錛屽氨鍙浠ヤ笉蹇呯悊浼氱敤鎴峰拰瀵嗙爜錛岀洿鎺ョ敤錛

[root@localhost ~]# smbclient -L //192.168.1.3
Password: 鐩存帴鎸夊洖杞

鐧誨綍鐢ㄦ埛韜浠絊amba鏈嶅姟鍣ㄥ叡浜

浠ョ敤鎴瘋韓浠界櫥褰曞叡浜鍚庯紝鑳借薄FTP鐢ㄦ埛涓鏍鳳紝涓嬩紶鍜屼笅杞芥枃浠訛紱鐢╬ut琛ㄧず涓婁紶錛岀敤get琛ㄧず涓嬭澆錛

smbclient //IP鍦板潃/鍏變韓鏂囦歡澶 -U 鐢ㄦ埛

璇存槑錛欼P鍦板潃澶у墮兘鐭ラ亾錛屼綘涓嶇煡閬撹嚜宸辯殑IP鍦板潃錛屽彲浠ョ敤/sbin/ifconfig 鏉ユ煡鐪嬶紱 鍏變韓鏂囦歡澶規槸鎴戜滑鍦╯mb.conf涓瀹氫箟鐨刐鍏變韓鏂囦歡澶筣錛屾瘮濡俒sir01]銆-U 鐢ㄦ埛鍚嶈〃紺篠amba 鐨勭敤鎴鳳紱

姣斿傦細

[root@localhost ~]# smbclient //192.168.1.3/sir01 -U sir01
Password:
Domain=[LINUXSIR] OS=[Unix] Server=[Samba 3.0.21b-2]
smb: \> ls

璇存槑錛氱櫥褰曞埌Samba鏈嶅姟鍣ㄤ笂錛屽氨鍙浠ョ敤smbclient鐨勪竴浜涙寚浠わ紝鍙浠ヨ薄鐢‵TP鎸囦護涓鏍蜂笂浼犲拰涓嬭澆鏂囦歡錛

smbclient 鍛戒護璇存槑

鍛戒護 璇存槑

?鎴杊elp [command] 鎻愪緵鍏充簬甯鍔╂垨鏌愪釜鍛戒護鐨勫府鍔
![shell command] 鎵ц屾墍鐢ㄧ殑SHELL鍛戒護錛屾垨璁╃敤鎴瘋繘鍏 SHELL鎻愮ず絎
cd [鐩褰昡 鍒囨崲鍒版湇鍔″櫒絝鐨勬寚瀹氱洰褰曪紝濡傛湭鎸囧畾錛屽垯 smbclient 榪斿洖褰撳墠鏈鍦扮洰褰
lcd [鐩褰昡 鍒囨崲鍒板㈡埛絝鎸囧畾鐨勭洰褰曪紱
dir 鎴杔s 鍒楀嚭褰撳墠鐩褰曚笅鐨勬枃浠訛紱
exit 鎴杚uit 閫鍑簊mbclient
get file1 file2 浠庢湇鍔″櫒涓婁笅杞絝ile1錛屽苟浠ユ枃浠跺悕file2瀛樺湪鏈鍦版満涓婏紱濡傛灉涓嶆兂鏀瑰悕錛屽彲浠ユ妸file2鐪佺暐
mget file1 file2 file3 filen 浠庢湇鍔″櫒涓婁笅杞藉氫釜鏂囦歡錛
md鎴杕kdir 鐩褰 鍦ㄦ湇鍔″櫒涓婂壋寤虹洰褰
rd鎴杛mdir 鐩褰 鍒犻櫎鏈嶅姟鍣ㄤ笂鐨勭洰褰
put file1 [file2] 鍚戞湇鍔″櫒涓婁紶涓涓鏂囦歡file1,浼犲埌鏈嶅姟鍣ㄤ笂鏀瑰悕涓篺ile2錛
mput file1 file2 filen 鍚戞湇鍔″櫒涓婁紶澶氫釜鏂囦歡
3.5.2 鍦╓indows涓璁塊棶Linux Samba鏈嶅姟鍣ㄥ叡浜鏂囦歡鐨勫姙娉曪紱

榪欎釜綆鍗曞惂錛屽湪緗戜笂棰嗗眳錛屾煡鐪嬪伐浣滅粍灝辮兘鐪嬪緱鍒幫紝鎴栬呭湪嫻忚堝櫒涓婅緭鍏ュ備笅鐨

\\ip鍦板潃鎴栬$畻鏈哄悕

榪欐牱灝辮兘鐪嬪埌榪欎釜鏈哄櫒涓婃湁浠涔堝叡浜鐨勪簡錛岀偣榧犳爣鎿嶄綔瀹屾垚錛涘傛灉璁塊棶涓嶄簡錛屼笉瑕佸繕璁版妸Linux鐨勯槻鐏澧欒勫垝娓呮帀錛屾垨璁╃浉搴旂殑絝鍙i氳繃錛

3.5.3 鍦↙inux涓璼mbfs鏂囦歡緋葷粺鐨勬寕杞斤紱

mount 鐨勭敤娉曪紝鍔犺澆緗戠粶涓鐨勫叡浜鏂囦歡澶瑰埌鏈鍦版満錛沵ount灝辨槸鐢ㄤ簬鎸傝澆鏂囦歡緋葷粺鐨勶紝SMB鍋氫負緗戠粶鏂囦歡緋葷粺鐨勪竴縐嶏紝涔熻兘鐢╩ount鎸傝澆錛泂mbmount璇村埌搴曚篃鏄鐢╩ount鐨勪竴涓鍙樼嶏紱

mount 鎸傝澆smbfs鐨勭敤娉曪紱

mount -t smbfs -o codepage=cp936,username=鐢ㄦ埛鍚,password=瀵嗙爜 , -l //ip鍦板潃/鍏變韓鏂囦歡澶瑰悕 鎸傝澆鐐

mount -t smbfs -o codepage=cp936,username=鐢ㄦ埛鍚,password=瀵嗙爜 , -l //璁$畻鏈哄悕/鍏變韓鏂囦歡澶瑰悕 鎸傝澆鐐

mount -t smbfs -o codepage=cp936 //ip鍦板潃鎴栬$畻鏈哄悕/鍏變韓鏂囦歡澶瑰悕 鎸傝澆鐐

smbmount鐨勭敤娉曪細

smbmount -o username=鐢ㄦ埛鍚,password=瀵嗙爜 , -l //ip鍦板潃鎴栬$畻鏈哄悕/鍏變韓鏂囦歡澶瑰悕 鎸傝澆鐐
smbmount //ip鍦板潃鎴栬$畻鏈哄悕/鍏變韓鏂囦歡澶瑰悕 鎸傝澆鐐

璇存槑錛

濡傛灉鎮ㄧ殑鏈嶅姟鍣ㄦ槸浠share鍏變韓鐨勶紝鍒欐棤闇鐢ㄦ埛鍚嶅拰瀵嗙爜灝辮兘鎸傝澆錛屽傛灉鍑虹幇瑕佸瘑鐮佺殑鎻愮ず錛岀洿鎺ュ洖杞﹀氨琛岋紱鎮ㄤ篃鍙浠ョ敤smbmount 鏉ユ寕杞斤紝榪欐牱灝辨棤闇鐢╩ount -t smbfs鏉ユ寚瀹氭枃浠剁郴緇熺殑綾誨瀷浜嗭紱

瀵逛簬鎸傝澆鐐癸紝鎴戜滑瑕佽嚜宸卞緩絝嬩竴涓鏂囦歡澶癸紝姣斿傛垜浠鍙浠ュ緩鍦/opt/smbhd錛岃繖鐢辨偍璇寸殑綆楀惂錛

鍦╩ount鐨勫懡浠や腑錛屾垜浠鍙戠幇鏈夎繖鏍風殑涓涓鍙傛暟codepage=cp936錛岃繖鏄鏈嶅姟鍣ㄧ鏂囦歡緋葷粺鐨勭紪鐮佺殑鎸囧畾錛宑p936 灝辨槸綆浣撲腑鏂囷紝褰撶劧鎮ㄥ彲浠ョ敤utf8絳夛紝灝濊瘯涓涓嬪惂銆

濡傛灉鎮ㄦ寕杞戒簡榪滅▼鐨剆mbfs鏂囦歡緋葷粺鍑虹幇鐨勬槸綆浣撲腑鏂囦貢鐮侊紝灝辮佽冭檻鎸傝澆鏃惰佹寚瀹氱紪鐮佷簡錛

4銆佺敱鏈綆鍗曠殑涓涓渚嬪瓙璇磋搗錛屽尶鍚嶇敤鎴峰彲璇誨彲鍐欑殑瀹炵幇錛

絎涓姝ワ細 鏇存敼smb.conf

鎴戜滑鏉ュ疄鐜頒竴涓鏈綆鍗曠殑鍔熻兘錛岃╂墍鏈夌敤鎴峰彲浠ヨ誨啓涓涓猄amba 鏈嶅姟鍣ㄥ叡浜鐨勪竴涓鏂囦歡澶癸紱鎴戜滑瑕佹敼鍔ㄤ竴涓媠mb.conf 錛涢栧厛鎮ㄨ佸囦喚涓涓媠mb.conf鏂囦歡錛

[root@localhost ~]# cd /etc/samba
[root@localhost samba]# mv smb.conf smb.confBAK

鐒跺悗鎴戜滑鏉ラ噸鏂板壋寤轟竴涓猻mb.conf鏂囦歡錛

[root@localhost samba]#touch smb.conf

鐒跺悗鎴戜滑鎶婁笅闈㈣繖孌靛啓鍏smb.conf涓錛

[global]
workgroup = LinuxSir
netbios name = LinuxSir05
server string = Linux Samba Server TestServer
security = share
[linuxsir]
path = /opt/linuxsir
writeable = yes
browseable = yes
guest ok = yes

娉ㄨВ錛

[global]榪欐墊槸鍏ㄥ矓閰嶇疆錛屾槸蹇呮靛啓鐨勩傚叾涓鏈夊備笅鐨勫嚑琛岋紱

workgroup 灝辨槸Windows涓鏄劇ず鐨勫伐浣滅粍錛涘湪榪欓噷鎴戣劇疆鐨勬槸LINUXSIR 錛堢敤澶у啓錛夛紱
netbios name 灝辨槸鍦╓indows涓鏄劇ず鍑烘潵鐨勮$畻鏈哄悕錛
server string 灝辨槸Samba鏈嶅姟鍣ㄨ存槑錛屽彲浠ヨ嚜宸辨潵瀹氫箟錛涜繖涓涓嶆槸浠涔堥噸瑕佺殑錛
security 榪欐槸楠岃瘉鍜岀櫥褰曟柟寮忥紝榪欓噷鎴戜滑鐢ㄤ簡share 錛涢獙璇佹柟寮忔湁濂藉氱嶏紝榪欐槸鍏朵腑涓縐嶏紱鍙﹀栦竴縐嶅父鐢ㄧ殑鏄痷ser鐨勯獙璇佹柟寮忥紱濡傛灉鐢╯hare鍛錛屽氨鏄涓嶇敤璁劇疆鐢ㄦ埛鍜屽瘑鐮佷簡錛

[linuxsir] 榪欎釜鍦╓indows涓鏄劇ず鍑烘潵鏄鍏變韓鐨勭洰褰曪紱
path = 鍙浠ヨ劇疆瑕佸叡浜鐨勭洰褰曟斁鍦ㄥ摢閲岋紱
writeable 鏄鍚﹀彲鍐欙紝榪欓噷鎴戣劇疆涓哄彲鍐欙紱
browseable 鏄鍚﹀彲浠ユ祻瑙堬紝鍙浠ワ紱鍙浠ユ祻瑙堟剰鍛崇潃錛屾垜浠鍦ㄥ伐浣滅粍涓嬭兘鐪嬪埌鍏變韓鏂囦歡澶廣傚傛灉鎮ㄤ笉鎯蟲樉紺哄嚭鏉ワ紝閭e氨璁劇疆涓 browseable=no

guest ok 鍖垮悕鐢ㄦ埛浠guest韜浠芥槸鐧誨綍錛

絎浜屾ワ細寤虹珛鐩稿簲鐩褰曞苟鎺堟潈錛

[root@localhost ~]# mkdir -p /opt/linuxsir
[root@localhost ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@localhost ~]# chown -R nobody:nobody /opt/linuxsir

娉ㄩ噴錛氬叧浜庢巿鏉僴obody錛屾垜浠鍏堢敤id鍛戒護鏌ョ湅浜唍obody鐢ㄦ埛鐨勪俊鎮錛屽彂鐜頒粬鐨勭敤鎴風粍涔熸槸nobody錛屾垜浠瑕佷互榪欎釜涓哄噯銆傛湁浜涚郴緇焠obody鐢ㄦ埛緇勫苟闈炴槸nobody 錛

絎涓夋ワ細鍚鍔╯mbd鍜宯mbd鏈嶅姟鍣錛

[root@localhost ~]# smbd
[root@localhost ~]# nmbd

絎鍥涙ワ細鏌ョ湅smbd榪涚▼錛岀『璁Samba 鏈嶅姟鍣ㄦ槸鍚﹁繍琛岃搗鏉ヤ簡錛

[root@localhost ~]# pgrep smbd
13564
13568

絎浜旀ワ細璁塊棶Samba 鏈嶅姟鍣ㄧ殑鍏變韓錛

鍦↙inux 涓鎮ㄥ彲浠ョ敤涓嬮潰鐨勫懡浠ゆ潵璁塊棶錛

[root@localhost ~]# smbclient -L //LinuxSir05
Password: 娉錛氱洿鎺ユ寜鍥炶濺

鍦╓indows涓錛屾偍鍙浠ョ敤涓嬮潰鐨勫姙娉曟潵璁塊棶錛

\\LinuxSir05\

5銆佸嶆潅涓鐐圭殑鐢ㄦ埛鍏變韓妯″瀷錛堥傚悎10浜哄乏鍙崇殑灝忓瀷浼佷笟錛夛紱

姣斿備竴涓鍏鍙告湁浜斾釜閮ㄩ棬錛屽垎鍒鏄痩inuxsir錛宻ir01錛宻ir02,sir03錛宻ir04銆傛垜浠鎯充負榪欏跺叕鍙歌捐′竴涓姣旇緝瀹夊叏鐨勫叡浜鏂囦歡妯″瀷銆傛瘡涓鐢ㄦ埛閮芥湁鑷宸辯殑緗戠粶紓佺洏錛宻ir01鍒皊ir04榪樻湁鍏辯敤鐨勭綉緇滅‖鐩橈紱鎵鏈夌敤鎴鳳紙鍖呮嫭鍖垮悕鐢ㄦ埛錛夋湁涓涓鍏變韓璧勬枡搴擄紝姝ゅ簱涓轟簡瀹夊叏鏄鍙璇葷殑錛涙墍鏈夌殑鐢ㄦ埛錛堝寘鎷鍖垮悕鐢ㄦ埛錛夎佹湁涓涓涓存椂鏂囦歡緇堣漿鐨勬枃浠跺す... ....

5.1 鍏變韓鏉冮檺璁捐″疄鐜扮殑鍔熻兘錛

1)linuxsir閮ㄩ棬鍏鋒湁綆$悊鎵鏈塖MB絀洪棿鐨勬潈闄愶紱
2)sir01鍒皊ir04鎷ユ湁鑷宸辯殑絀洪棿錛屽苟涓旈櫎浜嗚嚜韜鍙妉inuxsir鏈夋潈闄愪互澶栵紝瀵瑰叾瀹冪敤鎴峰叿鏈夌粷瀵歸殣縐佹э紱
3)linuxsir01鍒發inuxsir04鎷ユ湁涓涓鍏卞悓鐨勮誨啓鏉冮檺鐨勭┖闂達紱
4) 鎵鏈夌敤鎴鳳紙鍖呮嫭鍖垮悕鐢ㄦ埛錛夋湁涓涓鏈夎繪潈闄愮殑絀洪棿錛岀敤浜庤祫鏂欏簱錛屾墍浠ヤ笉瑕佹眰鍐欏叆鏁版嵁銆
5)sir01鍒皊ir04榪樻湁涓涓鍏卞悓鐨勭┖闂達紝瀵箂ir01鍒皊ir04鐨勭敤鎴鋒潵璇存槸闅愮佺殑錛屼笉鑳借╁叾瀹冪敤鎴鋒潵璁塊棶銆
6) 榪樿佹湁涓涓絀洪棿錛岃╂墍鏈夌敤鎴峰彲浠ュ啓鍏ワ紝鑳藉垹闄ょ瓑鍔熻兘錛屽湪鏉冮檺涓婃棤闄愬埗 錛岀敤浜庡叕鍙告墍鏈夌敤鎴風殑涓存椂鏂囨。緇堣漿絳夛紱

5.2 鍦ㄦ湇鍔″櫒涓婂壋寤虹浉搴旂殑鐩褰曪紱

[root@localhost ~]# mkdir -p /opt/linuxsir
[root@localhost ~]# cd /opt/linuxsir
[root@localhost linuxsir]# mkdir sir01 sir02 sir03 sir04 sirshare sir0104rw sirallrw
[root@localhost linuxsir]# ls
sir01 sir0104rw sir02 sir03 sir04 sirallrw sirshare

娉錛氬姛鐢ㄥ備笅錛

/opt/linuxsir 榪欐槸綆$悊鍛樼洰褰曪紝璐熻矗綆$悊鍏朵笅鎵鏈夌洰褰曪紱
/opt/linuxsir/sir01 鏄痵ir01鐨勫剁洰褰曪紝鐢ㄤ簬縐佺敤錛岄櫎浜嗙敤鎴鋒湰韜鍜宭inuxsir浠ュ栧叾瀹冪敤鎴烽兘鏄涓嶅彲璇諱笉鍙鍐欙紱
/opt/linuxsir/sir02 鏄痵ir02鐨勫剁洰褰曪紝鐢ㄤ簬縐佺敤錛岄櫎浜嗙敤鎴鋒湰韜鍜宭inuxsir浠ュ栧叾瀹冪敤鎴烽兘鏄涓嶅彲璇諱笉鍙鍐欙紱
/opt/linuxsir/sir03 鏄痵ir03鐨勫剁洰褰曪紝鐢ㄤ簬縐佺敤錛岄櫎浜嗙敤鎴鋒湰韜鍜宭inuxsir浠ュ栧叾瀹冪敤鎴烽兘鏄涓嶅彲璇諱笉鍙鍐欙紱
/opt/linuxsir/sir04 鏄痵ir04鐨勫剁洰褰曪紝鐢ㄤ簬縐佺敤錛岄櫎浜嗙敤鎴鋒湰韜鍜宭inuxsir浠ュ栧叾瀹冪敤鎴烽兘鏄涓嶅彲璇諱笉鍙鍐欙紱
/opt/linuxsir/sirshare 鎵鐢ㄧ敤鎴鳳紙闄や簡linuxsir鏈夋潈闄愬啓鍏ュ栵級鍙璇葷洰褰
/opt/linuxsir/sir0104rw 鏄鐢ㄤ簬sir01鍒皊ir04鐢ㄦ埛鍙璇誨彲鍐欏叡鐢ㄧ洰褰曪紝浣嗗尶鍚嶇敤鎴蜂笉鑳借誨啓錛
/opt/linuxsir/sirallrw 鐢ㄤ簬鎵鏈夌敤鎴鳳紙鍖呮嫭鍖垮悕鐢ㄦ埛錛夌殑鍙璇誨彲鍐欙紱

5.3 娣誨姞鐢ㄦ埛鐢ㄦ埛緇勶紝璁劇疆鐩稿簲鐩褰曞剁洰褰曠殑鏉冮檺錛

5.3.1 娣誨姞鐢ㄦ埛緇勶紱

[root@localhost ~]# /usr/sbin/groupadd linuxsir
[root@localhost ~]# /usr/sbin/groupadd sir01
[root@localhost ~]# /usr/sbin/groupadd sir02
[root@localhost ~]# /usr/sbin/groupadd sir03
[root@localhost ~]# /usr/sbin/groupadd sir04
[root@localhost ~]# /usr/sbin/groupadd sir0104

5.3.2 娣誨姞鐢ㄦ埛錛

[root@cuc03 ~]# adser -g sir01 -G sir0104 -d /opt/linuxsir/sir01 -s /sbin/nologin sir01
[root@cuc03 ~]# adser -g sir02 -G sir0104 -d /opt/linuxsir/sir02 -s /sbin/nologin sir02
[root@cuc03 ~]# adser -g sir03 -G sir0104 -d /opt/linuxsir/sir03 -s /sbin/nologin sir03
[root@cuc03 ~]# adser -g sir04 -G sir0104 -d /opt/linuxsir/sir04 -s /sbin/nologin sir04
[root@cuc03 ~]# adser -g linuxsir -d /opt/linuxsir -G linuxsir,sir01,sir02,sir03,sir04,sir0104 -d /opt/linuxsir -s /sbin/nologin linuxsir

涓轟粈涔堣繖鏍鋒坊鍔犵敤鎴鳳紵璇峰弬鑰冿細

銆奓inux 鏂囦歡鍜岀洰褰曠殑灞炴с
銆奓inux 鐢ㄦ埛綆$悊宸ュ叿浠嬬粛銆

褰撶劧鎴戜滑榪樺緱瀛︿細鏌ョ湅鐢ㄦ埛淇℃伅鐨勫伐鍏風敤娉曪紝姣斿 鐢╢inger鍜宨d鏉ユ煡鐪嬬敤鎴蜂俊鎮錛屼富瑕佹槸鐪嬬敤鎴鋒槸鍚︽坊鍔犳g『錛涙瘮濡傦紱璇峰弬鑰冦奓inux 鐢ㄦ埛錛圲ser錛夋煡璇㈢瘒銆

[root@localhost ~]# id linuxsir
[root@localhost ~]# finger linuxsir

5.3.3 娣誨姞samba鐢ㄦ埛錛屽苟璁劇疆瀵嗙爜錛

鎴戜滑鐢ㄧ殑鏂規硶鏄鍏堟坊鍔犵敤鎴鳳紝浣嗘坊鍔犵殑榪欎簺鐢ㄦ埛閮芥槸鉶氭嫙鐢ㄦ埛錛屽洜涓鴻繖浜涚敤鎴鋒槸涓嶈兘閫氳繃SHELL鐧誨綍緋葷粺鐨勶紱鍙﹀栧煎緱娉ㄦ剰鐨勬槸緋葷粺鐢ㄦ埛瀵嗙爜鍜孲amba鐢ㄦ埛鐨勫瘑鐮佹槸涓嶅悓鐨勩傚傛灉鎮ㄨ劇疆浜嗙郴緇熺敤鎴瘋兘鐧誨叆SHELL錛屽彲浠ヨ劇疆鐢ㄦ埛鐨凷amba瀵嗙爜鍜岀郴緇熺敤鎴烽氳繃SHELL鐧誨綍鐨勫瘑鐮佷笉鍚屻

鎴戜滑閫氳繃smbpasswd 鏉ユ坊鍔燬amba鐢ㄦ埛錛屽苟璁劇疆瀵嗙爜銆傚師鐞嗘槸閫氳繃璇誨彇/etc/passwd鏂囦歡涓瀛樺湪鐨勭敤鎴峰悕銆

[root@localhost sir01]# smbpasswd -a linuxsir
New SMB password: 娉錛氬湪榪欓噷娣誨姞Samba鐢ㄦ埛linuxsir鐨勫瘑鐮侊紱
Retype new SMB password: 娉錛氬啀杈撳叆涓嬈★紱

鐢ㄥ悓鏍風殑鏂規硶鏉ユ坊鍔 sir01銆乻ir02銆乻ir03銆乻ir04鐨勫瘑鐮侊紱

5.3.4 閰嶇疆鐩稿叧鐩褰曠殑鏉冮檺鍜屽綊灞烇紱

[root@cuc03 ~]# chmod 755 /opt/linux
[root@cuc03 ~]# chown linuxsir:linuxsir /opt/linuxsir
[root@cuc03 ~]# cd /opt/linuxsir
[root@cuc03 ~]# chmod 2770 sir0錛
[root@cuc03 ~]# chown sir01.linuxsir sir01
[root@cuc03 ~]# chown sir02.linuxsir sir02
[root@cuc03 ~]# chown sir03.linuxsir sir03
[root@cuc03 ~]# chown sir04.linuxsir sir04
[root@cuc03 ~]# chown linuxsir.sir0104 sir0104rw
[root@cuc03 ~]# chown linuxsir.linuxsir sirshare
[root@cuc03 ~]# chmod 755 sirshare
[root@cuc03 ~]# chown linuxsir:linuxsir sirallrw
[root@cuc03 ~]# chmod 3777 sirallrw

5.4 淇鏀筍amba閰嶇疆鏂囦歡 smb.conf錛

閰嶇疆鏂囦歡濡備笅錛屼慨鏀/etc/samba/smb.conf鍚庯紝涓嶈佸繕璁伴噸鍚痵mbd鍜宯mbd鏈嶅姟鍣錛

[global]
workgroup = LINUXSIR
netbios name = LinuxSir
server string = Linux Samba Test Server
security = share
[linuxsir]
comment = linuxsiradmin
path = /opt/linuxsir/
create mask = 0664
#create mask鏄鐢ㄦ埛鍒涘緩鏂囦歡鏃剁殑鏉冮檺鎺╃爜錛涘圭敤鎴鋒潵鍙璇誨彲鍐欙紝瀵圭敤鎴風粍鍙璇誨彲鍐欙紝瀵瑰叾瀹冪敤鎴峰彲璇伙紱
directory mask = 0775
#directory mask 鏄鐢ㄦ潵璁劇疆鐢ㄦ埛鍒涘緩鐩褰曟椂鐨勬潈闄愭帺鐮侊紝鎰忔濇槸瀵逛簬鐢ㄦ埛鍜岀敤鎴風粍鍙璇誨彲鍐欙紝瀵瑰叾瀹冪敤鎴峰彲璇誨彲鎵ц;
writeable = yes
valid users = linuxsir
browseable = yes
[sirshare]
path = /opt/linuxsir/sirshare
writeable = yes
browseable = yes
guest ok = yes
[sirallrw]
path = /opt/linuxsir/sirallrw
writeable = yes
browseable = yes
guest ok = yes
[sir0104rw]
comment = sir0104rw
path = /opt/linuxsir/sir0104rw
create mask = 0664
directory mask = 0775
writeable = yes
valid users = linuxsir,@sir0104
#@sir0104鏄鐢ㄦ埛緇勶紱
browseable = yes
[sir01]
comment = sir01
path = /opt/linuxsir/sir01
create mask = 0664
directory mask = 0775
writeable = yes
valid users = sir01,@linuxsir
browseable = yes
[sir02]
comment = sir02
path = /opt/linuxsir/sir02
create mask = 0664
directory mask = 0775
writeable = yes
valid users = sir02,@linuxsir
browseable = yes
[sir03]
comment = sir03
path = /opt/linuxsir/sir03
create mask = 0664
directory mask = 0775
writeable = yes
valid users = sir03,@linuxsir
browseable = yes
[sir04]
comment = sir04
path = /opt/linuxsir/sir04
create mask = 0664
directory mask = 0775
writeable = yes
valid users = sir04,@linuxsir
browseable = yes

㈡ 主機和虛擬機LINUX之間傳文件為什麼慢

對於你的這種情況,可能與你所使用的上傳工具有關。
對於虛擬機與主機之間文件的共享,你可以使用FTP,只要在主機或虛擬主機上建立一個FTP伺服器,就可以實現二者之間的文件共享了;另外,如果你所使用的虛擬機是VMware的話,你也可以選擇在Linux環境下安裝一下Vmware-tools來實現虛擬機與主機之間的文件共享。

㈢ 如何在虛擬機上的Linux系統配置FTP服務,跟Windows建立連接傳輸文件

在虛擬機上的Linux系統配置FTP服務,跟Windows建立連接傳輸文件的具體操作步驟如下:

1、在電腦上下載並安裝好小型FTP伺服器(Quick Easy FTP Server) 軟體,打開進行設置用戶名,用於遠程登錄。

熱點內容
白糖期貨存儲多長時間 發布:2024-11-26 23:15:53 瀏覽:805
phpgettext 發布:2024-11-26 23:13:19 瀏覽:644
安卓微信的卡包在哪裡 發布:2024-11-26 23:13:18 瀏覽:203
黑群暉伺服器變成電腦主機 發布:2024-11-26 23:07:32 瀏覽:84
修壓縮機多少錢 發布:2024-11-26 23:06:41 瀏覽:827
chm加密 發布:2024-11-26 23:05:54 瀏覽:518
自動存儲盤進化史 發布:2024-11-26 22:58:35 瀏覽:108
網課搜題源碼 發布:2024-11-26 22:55:23 瀏覽:308
linux修改遠程埠 發布:2024-11-26 22:35:53 瀏覽:982
卡通農場伺服器怎麼連不上 發布:2024-11-26 22:26:54 瀏覽:195