ubuntu下允许root用户ssh远程登录及Linux下服务的启动

来源:互联网 发布:淘宝买家钻号 编辑:程序博客网 时间:2024/06/02 23:46

参考:
1. http://blog.sina.com.cn/s/blog_7e64a87b0100rn8w.html
2. http://www.111cn.net/sys/Ubuntu/61252.htm (Ubuntu 14.04)

Ubuntu Server 12.04

SSH服务器,可以通过SSH协议来访问远程服务器,代替telnet和ftp。但是ubuntu默认是不启用root用户也不允许root远程登录的。所以需要先启用root用户

启用root用户:sudo passwd root //修改密码后就启用了。

安装OpenSSH server:
1. 使用apt命令安装openssh server
$ sudo apt-get install openssh-server
2. 可以对 openssh server进行配置
$ sudo vi /etc/ssh/sshd_config
找到PermitRootLogin no一行,改为PermitRootLogin yes
3. 重启 openssh server
$ sudo service ssh restart
4. 客户端如果是ubuntu的话,则已经安装好ssh client,可以用下面的命令连接远程服务器。
$ ssh xxx.xxx.xxx.xxx
如果是windows系统的话,可以使用SSH Secure Shell等ssh软件进行远程连接。

Ubuntu Server 14.04

Ubuntu Server 14.04 开启Root用户SSH权限:
sudo vi /etc/ssh/sshd_config
PermitRootLogin without-passwordwithout-assword修改为yes 即可。
修改好后别忘了重启sshd服务
sudo /etc/init.d/ssh restart 又或者是 sudo service ssh restart
之后,root用户即可直接SSH远程管理服务器了。从这里可以看出ubuntu server 14.04在安全方面还是有所提升的哈。

Linux下服务的启动

出处: http://blog.sina.com.cn/s/blog_70ac6bec01018mqs.html

下面以apache为例:

基本的操作方法:
本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况
apahce启动命令:
推荐/usr/local/apache2/bin/apachectl start apaceh启动
apache停止命令
/usr/local/apache2/bin/apachectl stop 停止
apache重新启动命令:
/usr/local/apache2/bin/apachectl restart 重启
要在重启 Apache 服务器时不中断当前的连接,则应运行:
/usr/local/sbin/apachectl graceful
如果apache安装成为linux的服务的话,可以用以下命令操作:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务

Linux系统为Ubuntu
一、Start Apache 2 Server /启动apache服务
# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start
二、 Restart Apache 2 Server /重启apache服务
# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart
三、Stop Apache 2 Server /停止apache服务
# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop

0 0