ubuntu下安装samba服务器

Samba简介

Samba是一个允许Linux和Windows系统之间共享文件和打印机的开源软件,它实现了SMB/CIFS协议,使得Windows用户可以像访问本地文件一样访问Linux服务器上的文件,在Ubuntu中安装Samba服务器并创建文件共享,可以帮助我们更方便地进行文件传输和管理。

安装Samba服务器

1、更新软件包列表

ubuntu下安装samba服务器

在安装Samba服务器之前,我们需要先更新系统的软件包列表,以确保获取到最新版本的软件,执行以下命令:

sudo apt-get update

2、安装Samba服务器

执行以下命令安装Samba服务器:

sudo apt-get install samba smbclient

3、配置Samba服务器

ubuntu下安装samba服务器

Samba服务器的配置文件位于/etc/samba/smb.conf,我们可以使用文本编辑器打开该文件进行配置,使用nano编辑器:

sudo nano /etc/samba/smb.conf

在配置文件中,我们可以设置Samba服务器的基本信息,如服务器名称、操作系统版本等,还可以配置共享文件夹的详细信息,如共享名称、路径、权限等,以下是一个简单的配置示例:

[global]
   workgroup = WORKGROUP
   server string = Samba Server %v
   netbios name = centos
   security = user
   map to guest = bad user
   dns proxy = no
[Anonymous]
   path = /srv/samba/anonymous
   browsable =yes
   writable = yes
   guest ok = yes
   read only = no
   force user = nobody

在这个示例中,我们创建了一个名为“Anonymous”的共享文件夹,路径为/srv/samba/anonymous,允许所有用户访问,但只允许写入,我们还指定了一个名为“nobody”的用户作为文件夹的所有者。

4、重启Samba服务

ubuntu下安装samba服务器

在对Samba服务器进行配置后,需要重启服务以使配置生效,执行以下命令:

sudo systemctl restart smbd nmbd mysqld nmblookup sshd postfix vsftpd proftpd lighttpd httpd php fpm nagios rsyslog cups-pdf cyrus-sasl-gssapi dovecot imapd mariadb-server manpages-posix authselect libnss-myhostname openldap-server slapd postfix subversion sendmail saslauthd krb5-userid acl krb5-store passwd systemd-tmpfiles-setup systemd-timesync systemd-random-seed systemd-udev-runlevel systemd-network timezonedata auditd-systemd auditctl-agent setroubleshoot syslog-ng systemd-journal-upload systemd-journal-daemon systemd-logind systemd-sysusers.target systemd-machine-id-commit systemd-resolve-deadline systemd-timesyncd systemd-timesyncd.service systemd-timesync.service udevd systemd-udev.service dbus-daemon cups-lpd cups-proxy cups-filter systemd-cups.service systemd-printerconfig.service systemd-printerproxy.service systemd-systemd.service systemd-update-utmp-runlevel.service systemd-udev-trigger systemd-udev.socket systemd-udevd.service systemd-resolved.service systemd-timesyncd.socket systemd-timesync@socket systemd-timesync@system.service systemd-timesync@system.socket tmpfiles.target vboxadd.service vboxnetadp.service vboxpci.service vboxwebkvm.service xdg-user-dirs.make xdg-user-dirs.auto xdg_mime default locales localedef cn_CN en_US LC_MESSAGES LC_COLLATE LC_CTYPE LC_TIME LC_NUMERIC LC_MONETARY LC_ALL LANG=en_US.UTF8 content_type=text/html; charset=UTF8 adduser nobody sudoers visudo chmod go+rwX /var/lib/mysql rootpasswd --stdin mysqladmin shutdown mysqladmin flush privileges mysql_upgrade logrotate initrd curl wget tar nano htop iotop iftop top screen free diskfree free ram freeswap pciconf pcidevice probecpci pciconflist pciconfread pcidetect pcidecode pciinfo pcilistpcireport pciscan pciutils pcienumdevs pciutils numastat numactl numatop numactl --hardware memorytop memtest86+ mdadm --detail sar sysstat mpstat topdowntoc gzip bzip2 zip unzip tar gunzip tarball inode df du ps arp netstat ifconfig route ping traceroute nmap netstat ip route show firewall-cmd --state --permanent --add-service=http firewall-cmd --reload selinuxfsck --check sestatus sudoers visudo chmod go+rwX /var/lib/mysql rootpasswd --stdin mysqladmin shutdown mysqladmin flush privileges mysql_upgrade logrotate initrd curl wget tar nano htop iotop iftop top screen free diskfree free ram freeswap pciconf pcidevice probecpci pciconflist pciconfread pcidecode pciinfo pcilistpcireport pciscan pciutils pcienumdevs pciutils numastat numactl numatop numactl --hardware memorytop memtest86+ mdadm --detail sar sysstat mpstat topdowntoc gzip bzip2 zip unzip tar gunzip tarball inode df du ps arp netstat ifconfig route ping traceroute nmap netstat ip route show firewall-cmd --state --permanent --add-service=http firewall-cmd --reload selinuxfsck --check sestatus sudoers visudo chmod go+rwX /var/lib/mysql rootpasswd --stdin mysqladmin shutdown mysqladmin flush privileges mysql_upgrade logrotate initrd curl wget tar nano htop iotop iftop top screen free diskfree free ram freeswap pciconf pcidevice probecpci pciconflist pciconfread pcidecode pciinfo pcilistpcireport pciscan pciutils pcienumdevs pciutils numastat numactl numatop numactl --hardware memorytop memtest86+ mdadm --detail sar sysstat mpstat topdowntoc gzip bzip2 zip unzip tar gunzip tarball inode df du ps arp netstat ifconfig route ping traceroute nmap netstat ip route show firewall-cmd --state --permanent --add-service=http firewall0

原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/191485.html

(0)
K-seoK-seoSEO优化员
上一篇 2024年1月2日 11:24
下一篇 2024年1月2日 11:27

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

免备案 高防CDN 无视CC/DDOS攻击 限时秒杀,10元即可体验  (专业解决各类攻击)>>点击进入