您好,登錄后才能下訂單哦!
在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 | <command>-----------------------------------------如果安裝,直接編輯配置文件
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。