最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

练习

IT圈 admin 41浏览 0评论

练习

1、查看80天以前的日期,重定向到文件/mnt/datafile,并查看80天以后的日期,追加到文件/mnt/datafile。

 

date -d -80days > /mnt/datefile

date -d +80days >> /mnt/datefile

 

2、配置vim的配置文件,使其拥有以下功能:显示行号、鼠标可以操纵光标位置。

 

man vim ##可以查看vim的配置文件是哪个

vim /etc/vimrc

在第13行开始写

set nu ##设置行号

set mouse=a ##设置鼠标可以操纵光标

 

3、新建用户redhat,用户说明为“redhat User”,并设置密码为redhat,该用户首次登陆需修改密码。

 

useradd -c "redhat User" redhat

watch -n 1 tail -n 3 /etc/passwd /etc/group ##查看是否建立成功

passwd redhat

chage -d 0 redhat ##修改密码期限

 

4、给redhat用户授权,可无密码创建用户westos,指定uid=1008,gid=1008,但不能删除westos用户。

 

visudo

在第99行

redhat localhost.localdomain=(root) NOPASSWD: /usr/sbin/useradd

su - redhat

sudo useradd westos -u 1008

 

5、找出cpu使用量排在前五的pid,并重定向到文件/mnt/pidfile中,并创建软连接/mnt/pid。

 

ps ax -o pid --sort -%cpu | head -6 (| grep PID -v ##去掉PID那一行) > /mnt/pidfile

ln -s /mnt/pidfile /mnt/pid

 

6、打包压缩/mnt下的文件为tar.gz格式,并无密码发送到真机kiosk用户的桌面,不忽略链接文件。

 

tar zcvf mnt.tar.gz /mnt/

在压缩包所在的主机里

ssh-keygen

ssh-copy-id -i /root/.ssh/id_rsa.pub kiosk@172.25.254.6

在真机kiosk里,以root用户

vim /etc/ssh/sshd_config

在78行,将yes改为no

在压缩包所在的主机里

rsync -lr /root/Desktop/mnt.tar.gz kiosk@172.25.254.6:/home/kiosk/Desktop

 

7、搭建第三方yum仓库,可用yum安装google,wps-office软件。

 

vim /etc/yum.repos.d/yum.repo

编辑

[software]

name=download software

baseurl=file:///software

gpgcheck=0

练习

1、查看80天以前的日期,重定向到文件/mnt/datafile,并查看80天以后的日期,追加到文件/mnt/datafile。

 

date -d -80days > /mnt/datefile

date -d +80days >> /mnt/datefile

 

2、配置vim的配置文件,使其拥有以下功能:显示行号、鼠标可以操纵光标位置。

 

man vim ##可以查看vim的配置文件是哪个

vim /etc/vimrc

在第13行开始写

set nu ##设置行号

set mouse=a ##设置鼠标可以操纵光标

 

3、新建用户redhat,用户说明为“redhat User”,并设置密码为redhat,该用户首次登陆需修改密码。

 

useradd -c "redhat User" redhat

watch -n 1 tail -n 3 /etc/passwd /etc/group ##查看是否建立成功

passwd redhat

chage -d 0 redhat ##修改密码期限

 

4、给redhat用户授权,可无密码创建用户westos,指定uid=1008,gid=1008,但不能删除westos用户。

 

visudo

在第99行

redhat localhost.localdomain=(root) NOPASSWD: /usr/sbin/useradd

su - redhat

sudo useradd westos -u 1008

 

5、找出cpu使用量排在前五的pid,并重定向到文件/mnt/pidfile中,并创建软连接/mnt/pid。

 

ps ax -o pid --sort -%cpu | head -6 (| grep PID -v ##去掉PID那一行) > /mnt/pidfile

ln -s /mnt/pidfile /mnt/pid

 

6、打包压缩/mnt下的文件为tar.gz格式,并无密码发送到真机kiosk用户的桌面,不忽略链接文件。

 

tar zcvf mnt.tar.gz /mnt/

在压缩包所在的主机里

ssh-keygen

ssh-copy-id -i /root/.ssh/id_rsa.pub kiosk@172.25.254.6

在真机kiosk里,以root用户

vim /etc/ssh/sshd_config

在78行,将yes改为no

在压缩包所在的主机里

rsync -lr /root/Desktop/mnt.tar.gz kiosk@172.25.254.6:/home/kiosk/Desktop

 

7、搭建第三方yum仓库,可用yum安装google,wps-office软件。

 

vim /etc/yum.repos.d/yum.repo

编辑

[software]

name=download software

baseurl=file:///software

gpgcheck=0

发布评论

评论列表 (0)

  1. 暂无评论