在linux下如何访问服务器

在linux下如何访问服务器,第1张

给虚拟机的Linux装一个ssh服务,开启之后再xp上用putty之类的ssh客户端访问。
当然还可以安装telnet服务,vnc服务等等,这些需要另外的客户端。

建议先提前了解所需的Linux命令,如下进行搜索

Linux服务器端准备工作

首先需要在Linux服务器上安装openssh-server,打开Linux服务器命令行终端,键入下面命令

sudo apt-get install openssh-server

修改Linux服务器的ssh配置文件

sudo gedit /etc/ssh/sshd_config

先使用”#”注释掉PermitRootLogin without-password

添加一行 PermitRootLogin yes

然后开启ssh服务

ps -e | grep ssh   

ntpq 命令开启NTP查询程序,你man一下ntpq就知道了其作用,
ntpq -p,-p参数显示所有已知的连接到NTP服务器的客户机信息列表以及他们的状态汇总,你这个结果显然是目前没有连接到NTP服务器的客户端。
自己多看看文档有帮助的
文档部分原文:
Purpose
Starts the standard Network Time Protocol (NTP) query program This command only
applies to AIX 42 or later
-p Displays a list of the peers known to the server and a summary of their
state Same as using the peers subcommand
xntpd是一个关于网络时间协议的守护进程,它遵循了因特网时间服务器的通用标准。在启动 xntpd 时, xntpd 会读取 /etc/ntpconf 配置文件来确定网络中系统时钟服务器,以 ntp 服务器的系统时间为标准,来调整本机的系统时间。
可以用 ntpq 命令来显示 xntpd 进程的内部变量。使用 ntp 时应注意,xntpd 服务器和 xntpd 客户端的时钟不能相差超过1000秒。若有大于1000秒的偏移,在客户端启动 xntpd 守护进程前,用 data 命令或 ntpdate 命令调整本机的系统时间,使偏移量在1000秒之内。 然后启动 xntpd
1 构造一个NTP环境的基本步骤(假设NTP不是运行在SP上):
11 设置NTP 服务器 (MASTER) , 其它NTP客户服务器以此服务器的时间为准,与其进行时间同步
111 编辑 /etc/ntpconf 文件, 内容如下:
----------------------------
#broadcastclient
server 12712710
driftfile /etc/ntpdrift
tracefile /etc/ntptrace
----------------------------
请注意文件中的 server 12712710 这一行, 此处的12712710 是一特殊的地址,表示NTP主服务器是与自身的系统时钟同步
112 编辑好 /etc/ntpconf后, 启动xntpd守护进程
# startsrc -s xntpd
也可通过调用smitty , 使 xntpd 在以后重启服务器时能自动启动
# smitty xntpd
113 xntpd 状态查询 , 使用 #lssrc -ls xntpd
刚启动xntpd时, sys peer 为 'insane', 表明xntpd还没有完成同步,
#lssrc -ls xntpd
Program name: --/usr/sbin/xntpd
Version: -------3
Leap indicator: 11 (Leap indicator is insane)
Sys peer: ------no peer, system is insane

等待 6 - 10 分钟后, sys peer 就不再是 'insane' 了
#lssrc -ls xntpd
Program name: --/usr/sbin/xntpd
Version: -------3
Leap indicator: 00 (No leap second today)
Sys peer: ------12712710

12 NTP客户端的设置
121 编辑 NTP 客户端上的 /etc/ntpconf文件, 内容如下:
----------------------------
#broadcastclient
server 918543189
driftfile /etc/ntpdrift
tracefile /etc/ntptrace
----------------------------
其中的 server 918543189 表明, 此客户端与IP地址为 918543189 的NTP服务器进行时间同步
122 在NTP客户端启动xntpd守护进程
# startsrc -s xntpd
也可通过调用smitty , 使 xntpd 在以后重启服务器时能自动启动
# smitty xntpd
123 查询xntpd的状态
当 system peer 不为 'insane' 时, 表明客户端已与服务器端成功地进行了同步
# lssrc -ls xntpd
Program name: --/usr/sbin/xntpd
Version: -------3
Leap indicator: 00 (No leap second today)
Sys peer: ------918543189


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/13490670.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-08-17
下一篇 2023-08-17

发表评论

登录后才能评论

评论列表(0条)

保存