## 如果想解壓*.src.rpm格式的包,可以執行rpm2cpio命令。
如下所示,有個*.src.rpm文件:
[ root@localhost liusu]# ll
total 1164
-rw-r--r-- 1 root root 1188824 Nov 15 09:42 openstack-keystone-9.0.0-1.el7.src.rpm
執行rpm2cpio命令來解壓:
[ root@localhost liusu]# rpm2cpio openstack-keystone-9.0.0-1.el7.src.rpm |cpio -iv
keystone-9.0.0.tar.gz
keystone-dist.conf
openstack-keystone-sample-data
openstack-keystone.logrotate
openstack-keystone.service
openstack-keystone.spec
openstack-keystone.sysctl
2331 blocks
如下所示,加壓後得文件列表:
[ root@localhost liusu]# ll
total 2352
-rw-rw-r-- 1 root root 1181342 Nov 15 09:43 keystone-9.0.0.tar.gz
-rw-rw-r-- 1 root root 263 Nov 15 09:43 keystone-dist.conf
-rw-r--r-- 1 root root 1188824 Nov 15 09:42 openstack-keystone-9.0.0-1.el7.src.rpm
-rw-rw-r-- 1 root root 96 Nov 15 09:43 openstack-keystone.logrotate
-rwxrwxr-x 1 root root 53 Nov 15 09:43 openstack-keystone-sample-data
-rw-rw-r-- 1 root root 242 Nov 15 09:43 openstack-keystone.service
-rw-rw-r-- 1 root root 10122 Nov 15 09:43 openstack-keystone.spec
-rw-rw-r-- 1 root root 201 Nov 15 09:43 openstack-keystone.sysctl
## .tar.bz2
套件名稱:bzip2。
壓縮:
[ jonny@linux ~ ]
$ tar jcvf FileName.tar.bz2 DirName
解壓縮:
[ jonny@linux ~ ]
$ tar jxvf FileName.tar.bz2
2018年9月3日 星期一
embededed system with CentOS boot setting terminal.
## CentOS boot setting.
** CentOS 6.9 boot setting.
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=0 serial console
default=1
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title Accusys 1U Switch Core (3nd Generation V2)
root (hd0,0)
kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=/dev/sda3 crashkernel=auto console=ttyS0,115200n8 acscfg=1
initrd /initramfs-2.6.32-696.el6.x86_64.img
title Accusys 1U Switch Core (3nd Generation V2) Dev
root (hd0,0)
kernel /bzImage ro root=/dev/sda3 crashkernel=auto console=ttyS0,115200n8 acscfg=1
initrd /initramfs-2.6.32-696.el6.x86_64.img
title CentOS 6 (2.6.32-696.el6.x86_64) Default boot setting
root (hd0,0)
kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=UUID=4df0d800-6b42-47f8-99da-5b50987f3824 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-696.el6.x86_64.img
** CentOS 5.8 boot setting.
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=0 serial console
default=2
timeout=5
title Accusys 1U Switch Core (3nd Generation)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-308.el5 ro root=/dev/sda1 crashkernel=128M@16M console=ttyS0,115200n8 acscfg=1
initrd /boot/initrd-2.6.18-308.el5.img
title Accusys 1U Switch Core (3nd Generation safe mode)
root (hd0,0)
kernel /boot/bzImage ro root=/dev/sda1 crashkernel=128M@16M console=ttyS0,115200n8 acscfg=1
initrd /boot/initrd-2.6.18-308.el5.img
title Accusys 1U Switch Core (3nd Generation Sam Debug mode)
root (hd0,0)
kernel /root/bzImage ro root=/dev/sda1 crashkernel=128M@16M console=ttyS0,115200n8 acscfg=1
initrd /boot/initrd-2.6.18-308.el5.img
## BIOS/GRUB/Kernel/XEN輸出重定向到串口的配置:
將BIOS輸出重定向到串口
這一功能需要主板支援,在BIOS中設置,比如我的設置為:
Server ManagementConsole RedirectionConsole Redirection設置為”Serial Port A”
將GRUB輸出重定向到串口(Edit /boot/grub/grub.conf)
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=5 console serial
grub引導過程中,會將輸出同時發送到終端螢幕和串口. grub引導過程中將在終端和連接到串口的超級終端上提示Press any key to continue,
每秒鐘提示一次,共5次,可修改menu.lst檔terminal行中的--timeout=10改變提示次數,在這一段時間內,可以在終端的鍵盤,
或者連接到串口的超級終端中按任意鍵進入grub選擇功能表.如果5秒內沒有在終端和連接串口的超級終端上按任意鍵,
則grub的選擇功能表將出現在console上,如果希望默認情況下, grub選擇功能表出現在串口上,則可修改grub.conf將console serial修改為serial console.
將kernel輸出資訊輸出到串口(編輯/boot/grub/grub.conf有的為menu.lst)
增加kernel引導參數如下:
kernel /boot/vmlinuz-2.6.32-29 root=/dev/hda1 ro console=ttyS0,115200n8 console=tty0
則kernel會將輸出資訊同時輸出到串口(ttyS0即COM1)和終端tty0。
其中,“ttyS0”表示串口使用COM1;“115200”表示串列傳輸速率為115200bps;“n”表示無校驗位;“8”表示有8位元資料位元
## kernel login message 修正為 Accusys login message
"cat /etc/issue"
Accusys PCIE SAN 1U Switch
Kernel \r on an \m
## To auto login to linux console on boot
edit /etc/init/tty.conf (但是Switch 是ttys0設定方式不同)
修正 /etc/init/tty.conf
"exec /sbin/mingetty $TTY"
改為
"exec /sbin/mingetty --autologin root $TTY"
[root@localhost ~]# cat /etc/init/tty.conf
# tty - getty
#
# This service maintains a getty on the specified device.
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file tty.override and put your changes there.
stop on runlevel [S016]
respawn
instance $TTY
#exec /sbin/mingetty $TTY
exec /sbin/mingetty --autologin root $TTY
usage 'tty TTY=/dev/ttyX - where X is console id'
[root@localhost ~]#
## To auto login to linux serial console on boot
edit /etc/init/serial.conf
修正 /etc/init/serial.conf
"exec /sbin/agetty /dev/$DEV $SPEED vt100-nav"
改為
"exec /sbin/agetty -n -l /usr/sbin/autologin /dev/$DEV $SPEED vt100-nav"
但是 /usr/sbin 找不到 autologin
我們要自己準備 autologin.c, code 如下,
#include "unistd.h"
int main()
{
execlp( "login", "login", "-f", "root", NULL);
}
產生執行檔
gcc autologin.c -o autologin, 將檔案放在你要存放的位子
[root@localhost ~]# cat /etc/init/serial.conf
# Automatically start a configured serial console
#
# How this works:
#
# On boot, a udev helper examines /dev/console. If a serial console is the
# primary console (last console on the commandline in grub), the event
# 'fedora.serial-console-available <port name> <speed>' is emitted, which
# triggers this script. It waits for the runlevel to finish, ensures
# the proper port is in /etc/securetty, and starts the getty.
#
# If your serial console is not the primary console, or you want a getty
# on serial even if it's not the console, create your own event e.g.
# /etc/init/ttyS0.conf with content:
# # ttyS0 - agetty
# #
# # This service maintains a agetty on ttyS0.
#
# stop on runlevel [S016]
# start on runlevel [23]
#
# respawn
# exec agetty -h -L -w /dev/ttyS0 115200 vt102
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file serial.override and put your changes there.
start on fedora.serial-console-available DEV=* and stopped rc RUNLEVEL=[2345]
stop on runlevel [S016]
instance $DEV
respawn
pre-start exec /sbin/securetty $DEV
#exec /sbin/agetty /dev/$DEV $SPEED vt100-nav
exec /sbin/agetty -n -l /root/autologin /dev/$DEV $SPEED vt100-nav
post-stop exec /sbin/initctl emit --no-wait fedora.serial-console-available DEV=$DEV SPEED=$SPEED
usage 'DEV=ttySX SPEED=Y - where X is console id and Y is baud rate'
Rebuild kernel with CentOS 6.9 Source code
## Get CentOS 6.9 Source code
"yum -y install kernel-devel" 安裝complier tool
"mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}" 創建一個Build source folder
"echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros" 指定創建位址
要在 CentOS-6 安裝源代碼套件及工具:
以 root 的身份安裝 rpm-build、redhat-rpm-config、asciidoc、bison、hmaccalc、patchutils、perl-ExtUtils-Embed、
xmlto、audit-libs-devel、binutils-devel、elfutils-devel、elfutils-libelf-devel、newt-devel、python-devel 及 zlib-devel 套件:
"yum -y install rpm-build redhat-rpm-config asciidoc bison hmaccalc patchutils perl-ExtUtils-Embed xmlto"
"yum -y install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel"
"yum -y install ncurses-devel newt-devel python-devel zlib-devel"
"yum -y install openssl-devel"
"yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto"
"yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel"
"yum install ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel"
從這些地方找尋內核的源代碼套件:
http://vault.centos.org/6.N/os/Source/SPackages/
http://vault.centos.org/6.N/updates/Source/SPackages/
or 直接抓取
"rpm -i http://vault.centos.org/6.9/updates/Source/SPackages/kernel-2.6.32-696.28.1.el6.src.rpm 2>&1 | grep -v exist"
Build 出 CentOS source code,
"cd ~/rpmbuild/SPECS"
"rpmbuild -bp --target=$(uname -m) kernel.spec"
Centos source code in /root/rpmbuild/BUILD/kernel-2.6.32-696.28.1.el6/linux-2.6.32-696.28.1.el6.x86_64
PS. 若發現GCC太舊,請update gcc "yum update gcc"
## 安裝網路設定命令工具
#系統設定套件 - setup 工具包
yum -y install setuptool
#系統設定套件 - 服務套件
yum -y install ntsysv
#系統設定套件 - 網路管理
yum -y install system-config-network-tui
#系統設定套件 - 防火牆設定
yum -y install system-config-firewall-tui
#系統設定套件 - 安全性設定
yum -y install system-config-securitylevel-tui
"yum -y install kernel-devel" 安裝complier tool
"mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}" 創建一個Build source folder
"echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros" 指定創建位址
要在 CentOS-6 安裝源代碼套件及工具:
以 root 的身份安裝 rpm-build、redhat-rpm-config、asciidoc、bison、hmaccalc、patchutils、perl-ExtUtils-Embed、
xmlto、audit-libs-devel、binutils-devel、elfutils-devel、elfutils-libelf-devel、newt-devel、python-devel 及 zlib-devel 套件:
"yum -y install rpm-build redhat-rpm-config asciidoc bison hmaccalc patchutils perl-ExtUtils-Embed xmlto"
"yum -y install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel"
"yum -y install ncurses-devel newt-devel python-devel zlib-devel"
"yum -y install openssl-devel"
"yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto"
"yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel"
"yum install ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel"
從這些地方找尋內核的源代碼套件:
http://vault.centos.org/6.N/os/Source/SPackages/
http://vault.centos.org/6.N/updates/Source/SPackages/
or 直接抓取
"rpm -i http://vault.centos.org/6.9/updates/Source/SPackages/kernel-2.6.32-696.28.1.el6.src.rpm 2>&1 | grep -v exist"
Build 出 CentOS source code,
"cd ~/rpmbuild/SPECS"
"rpmbuild -bp --target=$(uname -m) kernel.spec"
Centos source code in /root/rpmbuild/BUILD/kernel-2.6.32-696.28.1.el6/linux-2.6.32-696.28.1.el6.x86_64
PS. 若發現GCC太舊,請update gcc "yum update gcc"
## 安裝網路設定命令工具
#系統設定套件 - setup 工具包
yum -y install setuptool
#系統設定套件 - 服務套件
yum -y install ntsysv
#系統設定套件 - 網路管理
yum -y install system-config-network-tui
#系統設定套件 - 防火牆設定
yum -y install system-config-firewall-tui
#系統設定套件 - 安全性設定
yum -y install system-config-securitylevel-tui
How To Install lm_sensors on a CentOS / RHEL / Scientific Linux
## How To Install lm_sensors on a CentOS / RHEL / Scientific Linux
** To install lm-sensors on a CentOS, RHEL, Scientific and older version of Fedora Linux
(fedora v21 or older) to monitor fan speed and cpu temp info, type:
$ sudo yum install lm_sensors
** Once lm_sensors is installed you need to type:
$ sudo sensors-detect
** Next hit ENTER key for everything it suggests. At the end it will ask you whether to add
what it finds to /etc/modules. If you are happy with the output i.e. findings type “yes”.
To see the values for the hardware sensors detected on your motherboard / server, type:
$ sensors
** Sample outputs:
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +37.0?C (high = +80.0?C, crit = +90.0?C)
Core 0: +32.0?C (high = +80.0?C, crit = +90.0?C)
Core 1: +29.0?C (high = +80.0?C, crit = +90.0?C)
** Or use the following command:
$ sensors | less
$ sensors | egrep -i --color 'fan|cpu|temp'
## 讀取CPU溫度
cat /sys/class/thermal/thermal_zone1/temp
** To install lm-sensors on a CentOS, RHEL, Scientific and older version of Fedora Linux
(fedora v21 or older) to monitor fan speed and cpu temp info, type:
$ sudo yum install lm_sensors
** Once lm_sensors is installed you need to type:
$ sudo sensors-detect
** Next hit ENTER key for everything it suggests. At the end it will ask you whether to add
what it finds to /etc/modules. If you are happy with the output i.e. findings type “yes”.
To see the values for the hardware sensors detected on your motherboard / server, type:
$ sensors
** Sample outputs:
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +37.0?C (high = +80.0?C, crit = +90.0?C)
Core 0: +32.0?C (high = +80.0?C, crit = +90.0?C)
Core 1: +29.0?C (high = +80.0?C, crit = +90.0?C)
** Or use the following command:
$ sensors | less
$ sensors | egrep -i --color 'fan|cpu|temp'
## 讀取CPU溫度
cat /sys/class/thermal/thermal_zone1/temp
CentOS 6.9 eth setting
## CentOS 6.9 eth setting
** "cat /etc/sysconfig/network-scripts/ifcfg-eth0"
DEVICE=eth0
HWADDR=00:30:18:00:e1:65
TYPE=Ethernet
UUID=87093b7d-de84-4418-bbdd-a49f21a0be9d
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
USERCTL=no
PEERDNS=yes
IPV6INIT=no
IPADDR=10.10.8.190
GATEWAY=10.10.8.254
NETMASK=255.255.255.0
DNS1=10.10.0.9
DNS2=10.10.0.10
## DNS 設定
/etc/hosts :這個是最早的 hostname 對應 IP 的檔案;
/etc/resolv.conf :這個重要!就是 ISP 的 DNS 伺服器 IP 記錄處;
/etc/nsswitch.conf:這個檔案則是在『決定』先要使用 /etc/hosts 還是 /etc/resolv.conf 的設定!
"vim /etc/resolv.conf"
nameserver 168.95.1.1
nameserver 139.175.10.20
## CentOS 新增網卡
**找出目前所有網卡
dmesg | grep -in eth
387:[ 2.074571] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:37:d5:5a
388:[ 2.074587] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
412:[ 2.571363] e1000 0000:00:08.0 eth1: (PCI:33MHz:32-bit) 08:00:27:03:28:44
413:[ 2.571371] e1000 0000:00:08.0 eth1: Intel(R) PRO/1000 Network Connection
417:[ 2.588359] systemd-udevd[244]: renamed network interface eth1 to enp0s8
420:[ 2.597290] systemd-udevd[241]: renamed network interface eth0 to enp0s3
**找出新網卡 mac address
ifconfig
enp0s3: flags=4163 mtu 1500
inet 192.168.56.101 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::a00:27ff:fe37:d55a prefixlen 64 scopeid 0x20
ether 08:00:27:37:d5:5a txqueuelen 1000 (Ethernet)
RX packets 6911 bytes 3960745 (3.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6048 bytes 1263062 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
**產生新網卡的 UUID
# uuidgen enp0s8
297daa1e-a83d-471e-b70d-83eafb2f2470
**產生新網卡的 eth-scripts
cd /etc/sysconfig/network-scripts/
# cp ifcfg-enp0s3 ifcfg-enp0s8
AME、UUID、DEVICE、HWADDR修改為新網卡資料
# vi ifcfg-enp0s8
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s8
UUID=297daa1e-a83d-471e-b70d-83eafb2f2470
DEVICE=enp0s8
HWADDR=08:00:27:03:28:44
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
** "cat /etc/sysconfig/network-scripts/ifcfg-eth0"
DEVICE=eth0
HWADDR=00:30:18:00:e1:65
TYPE=Ethernet
UUID=87093b7d-de84-4418-bbdd-a49f21a0be9d
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
USERCTL=no
PEERDNS=yes
IPV6INIT=no
IPADDR=10.10.8.190
GATEWAY=10.10.8.254
NETMASK=255.255.255.0
DNS1=10.10.0.9
DNS2=10.10.0.10
## DNS 設定
/etc/hosts :這個是最早的 hostname 對應 IP 的檔案;
/etc/resolv.conf :這個重要!就是 ISP 的 DNS 伺服器 IP 記錄處;
/etc/nsswitch.conf:這個檔案則是在『決定』先要使用 /etc/hosts 還是 /etc/resolv.conf 的設定!
"vim /etc/resolv.conf"
nameserver 168.95.1.1
nameserver 139.175.10.20
## CentOS 新增網卡
**找出目前所有網卡
dmesg | grep -in eth
387:[ 2.074571] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:37:d5:5a
388:[ 2.074587] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
412:[ 2.571363] e1000 0000:00:08.0 eth1: (PCI:33MHz:32-bit) 08:00:27:03:28:44
413:[ 2.571371] e1000 0000:00:08.0 eth1: Intel(R) PRO/1000 Network Connection
417:[ 2.588359] systemd-udevd[244]: renamed network interface eth1 to enp0s8
420:[ 2.597290] systemd-udevd[241]: renamed network interface eth0 to enp0s3
**找出新網卡 mac address
ifconfig
enp0s3: flags=4163 mtu 1500
inet 192.168.56.101 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::a00:27ff:fe37:d55a prefixlen 64 scopeid 0x20
ether 08:00:27:37:d5:5a txqueuelen 1000 (Ethernet)
RX packets 6911 bytes 3960745 (3.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6048 bytes 1263062 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
**產生新網卡的 UUID
# uuidgen enp0s8
297daa1e-a83d-471e-b70d-83eafb2f2470
**產生新網卡的 eth-scripts
cd /etc/sysconfig/network-scripts/
# cp ifcfg-enp0s3 ifcfg-enp0s8
AME、UUID、DEVICE、HWADDR修改為新網卡資料
# vi ifcfg-enp0s8
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s8
UUID=297daa1e-a83d-471e-b70d-83eafb2f2470
DEVICE=enp0s8
HWADDR=08:00:27:03:28:44
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
2018年5月15日 星期二
CentOS 6.9 setting Samba with root folder
CentOS 6.9 setting Samba with root folder
1. install samba tool
"yum -y install samba"
2. 修正 "/etc/samba/smb.conf" 在 "Share Definitions" 增加下面設定
[root]
path = /root
writeable = yes
valid users = root
3. 關閉 selinux
修正 "/etc/selinux/config"
將 SELINUX=enforcing 改為 SELINUX=disabled
儲存後離開編輯器, 需要重新開機設定才會生效。
要檢查 SELinux 的狀態, 執行 sestatus 指令便可以看到:
# sestatus
設定防火牆
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload
關閉 Firewalld 防火牆指令:
# systemctl stop firewalld.service
設定下次開機不會啟動 Firewalld 防火牆
# systemctl disable firewalld.service
4. 使用 pdbedit 加入 root 這個使用者 , 前提是 root 必須是 smbuser 群組內的成員
"pdbedit -a root"
"pdbedit -L" 查看是否建立完成 , 可搭配 -vw 查看更詳細的資訊
5. 防火牆開啟SMB
可使用 #系統設定套件 - setup 工具包 設定
yum -y install setuptool
#系統設定套件 - 服務套件
yum -y install ntsysv
#系統設定套件 - 網路管理
yum -y install system-config-network-tui
#系統設定套件 - 防火牆設定
yum -y install system-config-firewall-tui
#系統設定套件 - 安全性設定
yum -y install system-config-securitylevel-tui
6. 開機啟動SMB
"chkconfig --level 35 smb on" 在3,5級別上自動運行samba服務
7. 運行samba服務
"service smb restart" or "/etc/init.d/smb restart"
** SAMBA 是透過兩支服務來控制這兩個步驟,分別是:
nmbd :這個 daemon 是用來管理工作群組啦、NetBIOS name 啦等等的解析。主要利用 UDP 協定開啟 port 137, 138 來負責名稱解析的任務;
smbd :這個 daemon 的主要功能就是用來管理 SAMBA 主機分享的目錄、檔案與印表機等等。 主要利用可靠的 TCP 協定來傳輸資料,開放的埠口為 139 及 445(不一定存在) 。
當我們啟動了 SAMBA 之後,主機系統就會啟動 137, 138 這兩個 UDP 及 139 這一個 TCP 埠口!
** 在LINUX下掛載samba共享文件
1.安裝samba client
"yum install samba-client samba-swat"
2.使用 smbclient 登入, 可以像FTP使用!
# smbclient –L //Samba server ip -U username%password
smbclient -L //192.168.1.90/public -u sandy
3.掛載samba 共享文件
# cd /mnt
# mkdir samba
# mount -t cifs -o username=root,password=1234567 //192.168.1.1/root /mnt/samba
# df -Th //查詢掛載是否成功
1. install samba tool
"yum -y install samba"
2. 修正 "/etc/samba/smb.conf" 在 "Share Definitions" 增加下面設定
[root]
path = /root
writeable = yes
valid users = root
3. 關閉 selinux
修正 "/etc/selinux/config"
將 SELINUX=enforcing 改為 SELINUX=disabled
儲存後離開編輯器, 需要重新開機設定才會生效。
要檢查 SELinux 的狀態, 執行 sestatus 指令便可以看到:
# sestatus
設定防火牆
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload
關閉 Firewalld 防火牆指令:
# systemctl stop firewalld.service
設定下次開機不會啟動 Firewalld 防火牆
# systemctl disable firewalld.service
4. 使用 pdbedit 加入 root 這個使用者 , 前提是 root 必須是 smbuser 群組內的成員
"pdbedit -a root"
"pdbedit -L" 查看是否建立完成 , 可搭配 -vw 查看更詳細的資訊
5. 防火牆開啟SMB
可使用 #系統設定套件 - setup 工具包 設定
yum -y install setuptool
#系統設定套件 - 服務套件
yum -y install ntsysv
#系統設定套件 - 網路管理
yum -y install system-config-network-tui
#系統設定套件 - 防火牆設定
yum -y install system-config-firewall-tui
#系統設定套件 - 安全性設定
yum -y install system-config-securitylevel-tui
6. 開機啟動SMB
"chkconfig --level 35 smb on" 在3,5級別上自動運行samba服務
7. 運行samba服務
"service smb restart" or "/etc/init.d/smb restart"
** SAMBA 是透過兩支服務來控制這兩個步驟,分別是:
nmbd :這個 daemon 是用來管理工作群組啦、NetBIOS name 啦等等的解析。主要利用 UDP 協定開啟 port 137, 138 來負責名稱解析的任務;
smbd :這個 daemon 的主要功能就是用來管理 SAMBA 主機分享的目錄、檔案與印表機等等。 主要利用可靠的 TCP 協定來傳輸資料,開放的埠口為 139 及 445(不一定存在) 。
當我們啟動了 SAMBA 之後,主機系統就會啟動 137, 138 這兩個 UDP 及 139 這一個 TCP 埠口!
** 在LINUX下掛載samba共享文件
1.安裝samba client
"yum install samba-client samba-swat"
2.使用 smbclient 登入, 可以像FTP使用!
# smbclient –L //Samba server ip -U username%password
smbclient -L //192.168.1.90/public -u sandy
3.掛載samba 共享文件
# cd /mnt
# mkdir samba
# mount -t cifs -o username=root,password=1234567 //192.168.1.1/root /mnt/samba
# df -Th //查詢掛載是否成功
2015年12月28日 星期一
訂閱:
文章 (Atom)
