fedora23搭建samba-server
来源:互联网 发布:matlab如何编程 编辑:程序博客网 时间:2024/06/05 18:27
1。首先是安装samba
2 添加samba的账户,这里添加给samba的账户需要在系统里现有这个人。
否则他会提示:
root@localhost ~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Failed to add entry for user test.
所以现在系统中添加这个账户
[root@localhost ~]# groupadd test -g 6000
[root@localhost ~]# useradd test -u 6000 -g 6000 -s /sbin/nologin -d /dev/null
当然,如果用系统现有的账户那就直接添加就行了
[root@localhost ~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Added user test.
其实这里有参考:https://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/sect-Managing_Confined_Services-Samba-Configuration_examples.html
10.4.4. Configuration examples
The following examples provide real-world demonstrations of how SELinux complements the Samba server and how full function of the Samba server can be maintained.
10.4.4.1. Sharing directories you create
The following example creates a new directory, and shares that directory through Samba:
Run rpm -q samba samba-common samba-client to confirm the samba, samba-common, and samba-client packages are installed. If any of these packages are not installed, install them by running yum install package-name as the root user.Run mkdir /myshare as the root user to create a new top-level directory to share files through Samba.Run touch /myshare/file1 as the root user to create an empty file. This file is used later to verify the Samba share mounted correctly.SELinux allows Samba to read and write to files labeled with the samba_share_t type, as long as /etc/samba/smb.conf and Linux permissions are set accordingly. Run the following command as the root user to add the label change to file-context configuration:semanage fcontext -a -t samba_share_t "/myshare(/.*)?"Run restorecon -R -v /myshare as the root user to apply the label changes:# restorecon -R -v /mysharerestorecon reset /myshare context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0restorecon reset /myshare/file1 context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0Edit /etc/samba/smb.conf as the root user. Add the following to the bottom of this file to share the /myshare/ directory through Samba:[myshare]comment = My sharepath = /mysharepublic = yeswriteable = noA Samba account is required to mount a Samba file system. Run smbpasswd -a username as the root user to create a Samba account, where username is an existing Linux user. For example, smbpasswd -a testuser creates a Samba account for the Linux testuser user:# smbpasswd -a testuserNew SMB password: Enter a passwordRetype new SMB password: Enter the same password againAdded user testuser.Running smbpasswd -a username, where username is the username of a Linux account that does not exist on the system, causes a Cannot locate Unix account for 'username'! error.Run service smb start as the root user to start the Samba service:service smb startStarting SMB services: [ OK ]Run smbclient -U username -L localhost to list the available shares, where username is the Samba account added in step 7. When prompted for a password, enter the password assigned to the Samba account in step 7 (version numbers may differ):$ smbclient -U username -L localhostEnter username's password:Domain=[HOSTNAME] OS=[Unix] Server=[Samba 3.5.2-59.fc13]Sharename Type Comment--------- ---- -------myshare Disk My shareIPC$ IPC IPC Service (Samba Server Version 3.5.2-59.fc13)username Disk Home DirectoriesDomain=[HOSTNAME] OS=[Unix] Server=[Samba 3.5.2-59.fc13]Server Comment--------- -------Workgroup Master--------- -------Run mkdir /test/ as the root user to create a new directory. This directory will be used to mount the myshare Samba share.Run the following command as the root user to mount the myshare Samba share to /test/, replacing username with the username from step 7:mount //localhost/myshare /test/ -o user=usernameEnter the password for username, which was configured in step 7.Run ls /test/ to view the file1 file created in step 3:$ ls /test/file1
sudo service smb start
sudo setenforce 0
- fedora23搭建samba-server
- ubuntu 搭建samba server
- SAMBA SERVER 的搭建
- fedora23 安装openssh-server
- fedora23 搭建时间服务器ntp
- Samba server
- Samba Server
- samba搭建
- 搭建samba
- samba搭建
- RHCE-Server-Samba
- linux samba server configuration
- [Linux]Samba server
- Ubuntu Samba Server
- ubuntu server 安装 samba
- samba 与 openssh-server
- create samba server
- 搭建简易Samba服务器
- Linux驱动之设备模型(1)
- Android.mk 语法
- Android中解析XML
- Java:比较运算符compareTo()、equals()、==之间的区别与应用总结
- OpenStack 性能测试项目Rally 部署
- fedora23搭建samba-server
- 【运动控制】运动控制卡接口函数API
- Linux驱动之设备模型(2)
- zabbix监控第一台主机
- SVN使用教程总结
- recyclerView通用适配器,支持添加多个header和footer
- ubuntu中apt-get安装与默认路径
- PHP程序员应该知道这些PHP知识
- Meanshift,聚类算法