一般在实际操作过程中都是在公司服务器上操作,很少有人会专门在家连接服务器学习linux。那么在家如何学习Linux呢?
简单,虚拟机就可以,还不用装双系统。我们可以在windows系统装安装vmWare,然后使用Liunx系统镜像就可以学习了,可以使用的Linux版本很多,Fedora、Suse、RedHat、Ubuntu等,我选用的是Fedora。
首先:连接服务器【本地操作不涉及,但是我们还是按照实战环境做下演练】
涉及两点:使用哪个用户,何种连接方式
linux中有一个超级用户root,权限最大,这个一般不会放开root远程登录的权限的,都是使用普通用户连接登录;连接方式一般是:SSH
假如使用的用户为admin,那么我们使用连接工具时在命令行中输入:ssh admin@服务器IP,然后输入密码即可
另外我们刚说到一般不会放开root远程登录权限,那要是二班呢,好吧,那就说下如何放开root远程登录权限吧
一般系统相关的配置都放在etc目录中,要开启远程权限就是修改/etc/ssh下的sshd_config文件。修改如下配置项为yes,如果首字符有#号注释还要去掉#。
PermitRootLogin yes
有的操作系统可能还需要在AllowsUser后添加 root,具体情况具体看,这里不做展开。
登录服务器之后,我们就可以“为所欲为”了,哈哈,开个玩笑,操作服务器还是要谨慎再谨慎的。此时,我们肯定是迫不及待的使用命令解决问题呀,但是不巧,命令的一些参数和说明记不起来了怎么办,怎么办呀,没事,系统有相应的帮助文档哦,如何使用呢?
命令 --help man 命令 //man是manual的缩写 info 命令 //info是information的缩写
第一种方式多个系统验证是没有问题的,后两种方式在Fedora也是没有问题的,在其他的系统有的不支持。
[root@localhost ssh]# cp --help Usage: cp [OPTION]... [-T] SOURCE DEST or: cp [OPTION]... SOURCE... DIRECTORY or: cp [OPTION]... -t DIRECTORY SOURCE... Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. -a, --archive same as -dR --preserve=all --attributes-only don't copy the file data, just the attributes --backup[=CONTROL] make a backup of each existing destination file -b like --backup but does not accept an argument --copy-contents copy contents of special files when recursive -d same as --no-dereference --preserve=links -f, --force if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used) -i, --interactive prompt before overwrite (overrides a previous -n option) -H follow command-line symbolic links in SOURCE -l, --link hard link files instead of copying -L, --dereference always follow symbolic links in SOURCE -n, --no-clobber do not overwrite an existing file (overrides
now,查看cp命令的帮助文档,只截取了一部分参数。
现在命令也想起来了,我突然忘了我在系统那个位置了,这个可咋整?不要慌,要查看在那个路径下,使用pwd命令
[root@localhost ssh]# pwd /etc/ssh
输入pwd,系统回复你:傻子,你在/etc/ssh目录下,你刚修改root的远程登录了。哦my god。你看我这脑子。。。