【求助】OpenSUSE如何共享文件夹,从Windows映射访问
opensuse吧
全部回复
仅看楼主
level 2
dopudabd 楼主
最近想折腾linux,虚拟机里装了个OpenSUSE 文本模式的。但是想将虚拟机里的文件夹映射到windows里遇到了麻烦。在网上看了好多教程都是用samba。查看了系统里面samba好像不完整。也从新下载了(sudo zypper install samba).但是还是找不到sma这个服务。具体要怎么弄呢?请帮帮忙指点一下。
2014年09月10日 01点09分 1
level 2
dopudabd 楼主
这个操作换做文本模式是什么命令?
如何确保 yast2-samba-server 和 samba 软件包已经安装 ?文本模式下要如何装?
2014年09月10日 01点09分 2
level 2
dopudabd 楼主
1 Preliminary Note
I*m using an OpenSUSE 12.3 system here with the hostname server1.example.com and the IP address 192.168.0.100.
2 Installing Samba
We can install Samba as follows:
zypper install cups-libs samba
Unfortunately Samba conflicts with the package patterns-openSUSE-minimal_base-conflicts. Therefore we must choose to uninstall that package:
server1:~ # zypper install cups-libs samba
Loading repository data...
Reading installed packages...
*cups-libs* is already installed.
No update candidate for *cups-libs-1.5.4-5.2.1.x86_64*. The highest available version is already installed.
Resolving package dependencies...
Problem: samba-3.6.12-59.2.1.x86_64 requires samba-client >= 3.6.12, but this requirement cannot be provided
uninstallable providers: samba-client-3.6.12-59.2.1.x86_64[openSUSE-12.3-1.7]
samba-client-3.6.12-59.2.1.i586[repo-oss]
samba-client-3.6.12-59.2.1.x86_64[repo-oss]
Solution 1: deinstallation of patterns-openSUSE-minimal_base-conflicts-12.3-7.10.1.x86_64
Solution 2: do not install samba-3.6.12-59.2.1.x86_64
Solution 3: do not install samba-3.6.12-59.2.1.x86_64
Solution 4: break samba-3.6.12-59.2.1.x86_64 by ignoring some of its dependencies
Choose from above solutions by number or cancel [1/2/3/4/c] (c): <-- 1
Edit the smb.conf file:
vi /etc/samba/smb.conf
Make sure you have the following lines in the [global] section:
[...] security = user passdb backend = tdbsam[...]
This enables Linux system users to log in to the Samba server.
(If you get the message You do not have a valid vim binary package installed. Please install either "vim", "vim-enhanced" or "gvim"., please run
zypper install vim
to install vi and try again. )
Then create the system startup links for Samba and start it:
systemctl enable smb.service
systemctl start smb.service
3 Adding Samba Shares
Now I will add a share that is accessible by all users.
Create the directory for sharing the files and change the group to the users group:
mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/
At the end of the file /etc/samba/smb.conf add the following lines:
vi /etc/samba/smb.conf
[...][allusers] comment = All Users path = /home/shares/allusers valid users = @users force group = users create mask = 0660 directory mask = 0771 writable = yes
If you want all users to be able to read and write to their home directories via Samba, add the following lines to /etc/samba/smb.conf (make sure you comment out or remove the other[homes] section in the smb.conf file!):
[...][homes] comment = Home Directories browseable = no valid users = %S writable = yes create mask = 0700 directory mask = 0700
Now we restart Samba:
systemctl restart smb.service
4 Adding And Managing Users
In this example, I will add a user named tom. You can add as many users as you need in the same way, just replace the username tom with the desired username in the commands.
useradd tom -m -G users
(If you see the following error, please ignore it:
server1:~ # useradd tom -m -G users
configuration error - unknown item *LASTLOG_ENAB* (notify administrator)
server1:~ #
)
Set a password for tom in the Linux system user database. If the user tom should not be able to log in to the Linux system, skip this step.
passwd tom
-> Enter the password for the new user.
Now add the user to the Samba user database:
sm
bp
asswd -a tom
-> Enter the password for the new user.
Now you should be able to log in from your Windows workstation with the file explorer (address is \\192.168.0.100 or \\192.168.0.100\tom for tom*s home directory) using the usernametom and the chosen password and store files on the Linux server either in tom*s home directory or in the public shared directory.
照着这个做了一遍也没用。。。
2014年09月10日 02点09分 4
level 11
SuSEfirewall2 off 禁用防火墙试试
2014年09月10日 03点09分 5
试过了也没用
2014年09月10日 04点09分
level 11
browseable改成yes
2014年09月10日 04点09分 6
总之是配置问题了,贴的配置格式太乱了。。。
2014年09月10日 05点09分
level 2
dopudabd 楼主
# vim /etc/samba/smb.conf
read only = No
inherit acls = Yes
create mask = 0700
directory mask = 0700
[profiles]
comment = Network Profiles Service
path = %H
read only = No
store dos attributes = Yes
create mask = 0600
directory mask = 0700
[users]
comment = All users
path = /home
read only = No
inherit acls = Yes
veto files = /aquota.user/groups/shares/
[groups]
comment = All groups
path = /home/groups
read only = No
inherit acls = Yes
[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @ntadmin root
force group = ntadmin
create mask = 0664
directory mask = 0775
[share]
comment = share
path = /home/myfiles
create mask = 0660
directory mask = 0771
writable = yes
browseable = yes
public = yes
@我爱麻省理工
2014年09月10日 05点09分 7
level 2
dopudabd 楼主
郁闷了,相互ping能ping通。就是共享不了
2014年09月10日 06点09分 8
level 11
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = share # user 和share
passdb backend = tdbsam
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable =yes
#------------ 以下是自定义部分------------------
[HOME]
comment = abby*s home
path = /home/abby
public = yes
browsable = yes
writable = yes
guest ok = yes
# end
systemctl start smbd
systemctl enable smbd
2014年09月10日 06点09分 9
systemctl start smbd 这个命令执行后提醒该方法调用失败,smbd.service 没有这个文件。
2014年09月10日 06点09分
回复 dopudabd :反正就是开启samba服务啦! systemctl start samba试试吧。 man一下samba看看? PS:我在上课。。。
2014年09月10日 07点09分
回复 我爱麻省理工 :谢了。我再琢磨琢磨
2014年09月10日 07点09分
level 1
虚拟机都提供了档案共享功能。
装openSuSE你可以试试Virtualbox。openSuSE对其支持很好。Virtualbox提供了vboxsf,可以很简单的在host与guest之间共享资料。
你如果用samba,不仅要配置samba,还要配置SuSEfirewall2,AppArmor,还要配置网路,如果是用NAT,还有做端口映射,想想都麻烦................ ╮(╯▽╰)╭
2014年09月10日 09点09分 10
汗。。。恐怖啊。。。都折腾两天了。主要是文本模式比较麻烦。。。不想上图形界面。机器太卡了。晚上再试试virtualbox吧。
2014年09月10日 09点09分
1