如果是服务器可以参考:
[root@localhost /]# yum install ntp -y
2.修改NTP配置文件,添加NTP服务器的网络位置/etc/ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.1.1 iburst #目标服务器网络位置
#server 1.CentOS.pool.ntp.org iburst #一下三个是CentOS官方的NTP服务器,我们注释掉
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#broadcast 192.168.1.255 autokey# broadcast server
#broadcastclient# broadcast client
#broadcast 224.0.1.1 autokey# multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
保存退出
3.启动服务并设置开启自启
[root@localhost /]# systemctl start ntpd.service#启动服务
[root@localhost /]# systemctl enable ntpd.service#设置为开机启动
Linux服务器端准备工作
首先需要在Linux服务器上安装openssh-server,打开Linux服务器命令行终端,键入下面命令
sudo apt-get install openssh-server
1
修改Linux服务器的ssh配置文件
sudo gedit /etc/ssh/sshd_config1先使用”#”注释掉PermitRootLogin without-password
添加一行 PermitRootLogin yes
然后开启ssh服务
ps -e | grep ssh
1
客户端准备工作
客户端既可以是Windows系统用户,也可以是Linux系统用户,下面我们就分别介绍这两种系统如何来连接Linux服务器
Ubuntu系统
一般情况下,Ubuntu系统都是自带了openssh-client,如果没有安装,在命令行键入下面
sudo apt-get install openssh-client1如果已经安装好了openssh-client,那么可以使用下面的命令连接服务器
ssh username@IP1这里的username是服务器的一个用户账号,IP也是服务器的IP地址
Windows系统
Windows平台下有许多提供ssh服务的软件,我们在这里使用Xshell 5软件
打开Xshell 5软件,点击左上角的新建
在主机处输入Linux服务器的IP地址,协议选择为ssh,端口号为22
点击确定按钮,再点击连接,此时会d出一个交互窗口,输入服务器的一个账户和密码
数据传输
下面我们就分别介绍Windows和Linux两种系统如何与Linux服务器进行数据传输
Ubuntu系统
在于服务器连接正常后,再次打开一个命令行终端,键入以下命令,就可以将客户端数据传入服务器
scp ./filename username@IP:/home/bio321/Desktop1也可以将服务器端的数据传入到客户端,键入以下命令
scp username@IP:/home/bio321/Desktop/filename ./data 1Windows系统
在Linux服务器安装lrzsz,服务器端打开命令行,键入以下命令安装
sudo apt-get install lrzsz1将客户端数据传入服务端,服务端打开命令行,键入命令rz
将服务端数据传入客户端,服务端打开命令行,键入命令sz
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)