扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
在unix里没有sudo的环境,需要先安装sudo,在配置sudo,
大足网站建设公司创新互联,大足网站设计制作,有大型网站制作公司丰富经验。已为大足上千家提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的大足做网站的公司定做!
我这个是自己的环境,各位配合自己的环境使用哦
1,检查sudo是否安装,如果安装直接配置就可以。
2,下载sudo,或者是用ftp
3,安装sudo
4,配置sudo
。。。。。。。在安装中是用源码安装的,一定要编译好,要不然找不到配置文件。下面的网址结合看会更明白。
安装和配置sudo :http://linux.chinaunix.net/techdoc/install/2006/03/05/928431.shtml
1、输入sudo命令测试此linux系统是否安装了sudo工具,如果安装,直接编辑配置文件
# sudo ------------------看一下是否安装了sudo
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
[-u username/#uid] -s |
2、下载sudo
cs_svr17[/tmp]#cd /tmp---------------------------------进入/tmp目录下
cs_svr17[/tmp]#pwd------------------------------------确认是tmp目录
/tmp
cs_svr17[/tmp]#ftp 218.206.191.9 --------------------ftp地址
Connected to 218.206.191.9.
220 (vsFTPd 2.2.2)
Name (218.206.191.9:szcare): sheng2----------------输入用户名sheng2
331 Please specify the password. ------------------------输入密码ENGsh%029
Password:-----------------------------------密码错误
530 Login incorrect.
Login failed.
ftp> by ----
221 Goodbye.
cs_svr17[/tmp]#ftp 218.206.191.9 ----------------------------从新输入
Connected to 218.206.191.9.
220 (vsFTPd 2.2.2)
Name (218.206.191.9:szcare): sheng2---------------------输入用户名
331 Please specify the password.---------------------------------输入密码
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd chaijx/omc---------------------------------------------------进入放ftp的目录
250 Directory successfully changed.
ftp> ls-------------------------------------------------------------------查看文件内容,没有我们要的包输入bin转换成2进制
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r-- 1 605 600 154679 May 31 11:28 oam-system-config.xml
-rw-rw-r-- 1 605 600 1648640 May 31 12:16 sudo-1.6.7p5.tar
-rw-rw-r-- 1 605 600 1013760 May 31 12:16 sudo-1.6.9p17-ia64-11.23.depot.gz
-rw-rw-r-- 1 605 600 525861 May 31 12:16 sudo-1.7.1-ia64-11.23.depot.gz
-rw-rw-r-- 1 605 600 1858612 May 31 12:16 sudo-1.8.6p8.tar.gz
226 Directory send OK.
ftp> bin----------------------转换成2进制后下载需要的包
200 Switching to Binary mode.
ftp> get sudo-1.6.7p5.tar ------------------------------------------------下载sudo包
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for sudo-1.6.7p5.tar (1648640 bytes).
226 Transfer complete.
1648640 bytes received in 0.19 seconds (8309.33 Kbytes/s)
ftp> mget sudo* -----------------------------------------------下载全部的sudo包一直按Y
mget sudo-1.6.7p5.tar? y
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for sudo-1.6.7p5.tar (1648640 bytes).
226 Transfer complete.
1648640 bytes received in 0.20 seconds (8113.32 Kbytes/s)
mget sudo-1.6.9p17-ia64-11.23.depot.gz? y
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for sudo-1.6.9p17-ia64-11.23.depot.gz (1013760 bytes).
226 Transfer complete.
1013760 bytes received in 0.11 seconds (9062.70 Kbytes/s)
mget sudo-1.7.1-ia64-11.23.depot.gz? y
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for sudo-1.7.1-ia64-11.23.depot.gz (525861 bytes).
226 Transfer complete.
525861 bytes received in 0.06 seconds (7937.68 Kbytes/s)
mget sudo-1.8.6p8.tar.gz? y
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for sudo-1.8.6p8.tar.gz (1858612 bytes).
226 Transfer complete.
1858612 bytes received in 0.23 seconds (7847.07 Kbytes/s)
ftp> by
221 Goodbye.
cs_svr17[/tmp]#ls
.AgentSockets start_daf.txt
.kc.trace start_daf_err.log
.s.PGSQL.10864 start_daf_tmp.txt
.s.PGSQL.10864.lock start_serv.log
X11_newfonts.log start_serv.txt
hpce start_serv_err.log
install.vars start_serv_tmp.txt
ipv6agt.crashlog stop_daf.log
krun.1541 stop_daf.txt
llbdbase.dat stop_serv.log
lost+found stop_serv.txt
ncweb_apa.log sudo-1.6.7p5.tar
ncweb_iether.log sudo-1.6.9p17-ia64-11.23.depot.gz
portmap.file sudo-1.7.1-ia64-11.23.depot.gz
rpcbind.file sudo-1.8.6p8.tar.gz
sd_ipd_acl.2727 swlist
start_daf.log zabbix_agentd.pid
cs_svr17[/tmp]#
3、安装sudo
# tar -xvf sudo-1.6.7p5.tar ------------解压sudo
# cd /tmp/sudo-1.6.7p5
# ./configure --prefix=/usr/local/sudo --bindir=/usr/bin --sbindir=/usr/sbin --mandir=/usr/share/man --sysconf=/etc ------------------编译sudo,visudo,man的配置文件
# make
# make installn
4、编辑配置文件
进入/etc修改/sudoers配置文件
cs_svr17[/]#cd /etc ------------进入/etc
cs_svr17[/etc]#pwd
/etc
cs_svr17[/etc]#ll sudo*--------------查看sudo的文件,找到sudoers
-r--r----- 1 root root 580 May 31 20:39 sudoers
cs_svr17[/etc]#cat sudoers------------查看sudoers
我是直接执行visudo的命令
#visudo
软件从源码包安装过程:
./configure #编译sudo软件
make#执行编译sudo软件
make install#安装编译sudo软件
export PATH=$PATH:/usr/local/bin:/usr/local/sbin #修改可执行文件的查找路径
which sudo#查找可执行软件所在位置
sudo --help -------------检查sudo已经安装
export PATH=$PATH:/usr/local/bin:/usr/local/sbin----如果没有编译,就需要零时添加变量到 profile
或者是永久添加变量# vi /etc/profile
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流