① 怎麼在linux中配置oracle的環境變數
需要設置Oracle_HOME和ORACLE_SID兩個環境變數,再把ORACLE的bin目錄添加到PATH中即可,通常預設安裝的情況下:
ORACLE_SID=orcl
ORACLE_HOME=/home/oracle/oracle/proct/10......這樣的形式
操作步驟:
1、su oracle並回車切換到oracle用戶;
2、cd並回車回到oracle用戶目錄;
cd /home/oracle
ls -a
3、vi .bash_profile並回車編輯該文件,按I鍵進入插入狀態,在最後加入以下行:
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/proct/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
輸入完畢後按ESC鍵退出vi編輯狀態,
輸入:wq並回車存檔退出。
注銷所有oracle用戶,再使用oracle登錄即可。
注意輸入wq前面有個:冒號,先輸入這個:就可以在編輯器最底端輸入命令了。
② linux鍛戒護idlinux鍛戒護id
id鍛戒護瑙i噴錛
id鍛戒護鍙浠ユ樉紺虹湡瀹炴湁鏁堢殑鐢ㄦ埛ID(UID)鍜岀粍ID(GID)銆俇ID鏄瀵逛竴涓鐢ㄦ埛鐨勫崟涓韜浠芥爣璇嗐傜粍ID錛圙ID錛夊垯瀵瑰簲澶氫釜UID銆俰d鍛戒護宸茬粡榛樿ら勮呭湪澶у氭暟Linux緋葷粺涓銆傝佷嬌鐢ㄥ畠錛屽彧闇瑕佸湪浣犵殑鎺у埗鍙拌緭鍏id銆備笉甯﹂夐」杈撳叆id浼氭樉紺哄備笅銆傜粨鏋滀細浣跨敤媧昏穬鐢ㄦ埛銆
褰撴垜浠鎯崇煡閬撴煇涓鐢ㄦ埛鐨刄ID鍜孏ID鏃秈d鍛戒護鏄闈炲父鏈夌敤鐨勩備竴浜涚▼搴忓彲鑳介渶瑕乁ID/GID鏉ヨ繍琛屻俰d浣挎垜浠鏇村姞瀹規槗鍦版壘鍑虹敤鎴風殑UID浠GID鑰屼笉蹇呭湪/etc/group鏂囦歡涓鎼滃匯傚傚線甯鎬竴鏍鳳紝浣犲彲浠ュ湪鎺у埗鍙拌緭鍏manid榪涘叆id鐨勬墜鍐岄〉鏉ヨ幏鍙栨洿澶氱殑璇︽儏銆
linux鏌ョ湅oracle鐢ㄦ埛鍜岀敤鎴風粍錛
鎴戠殑錛歀inux涓嬪彲浠ヤ嬌鐢╥d鍛戒護鏌ョ湅鐢ㄦ埛鐨勪俊鎮鍜岀粍銆
鍙浠ユ墦寮緇堢鍚庢墽琛#idoracle鍛戒護榪涜屾煡鐪嬨
濡備綍鍦╨inux涓婄敤鍛戒護瀹炵幇鐢ㄦ埛鍜岀粍鐨勭$悊錛
Linux涓婄敤鍛戒護瀹炵幇鏈鍦扮敤鎴峰拰緇勭殑綆$悊
鏈鍦扮敤鎴峰拰緇勶細綆$悊鏂囦歡鍜岃繘紼嬬瓑絳
鏈鍦扮敤鎴峰拰緇勶細
1錛塺oot:瓚呯駭綆$悊鍛樼郴緇熷壋寤虹殑絎涓涓璐︽埛
鐗圭偣錛
id涓:0
瀹剁洰褰曪細/root
鍏鋒湁緋葷粺鐨勫畬鍏ㄦ帶鍒舵潈:灝忓績浣跨敤銆
#id
uid=0(root)gid=0(root)groups=0(root)context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
#
2錛夋櫘閫氱敤鎴鳳細涓嶅叿鏈夌$悊鍛樻潈闄
鐗圭偣錛
id鑼冨洿錛
1000=id=60000
瀹剁洰褰曪細/home/鐢ㄦ埛鍚
#idstudent
uid=1000(student)gid=1000(student)groups=1000(student),10(wheel)
#
3錛夋湇鍔$敤鎴鳳細涓烘湇鍔℃彁渚涙潈闄
鐗圭偣錛
id鑼冨洿錛
0id1000
瀹剁洰褰曪細搴旂敤紼嬪簭鏈嶅姟鐩褰
#idapache
uid=48(apache)gid=48(apache)groups=48(apache)
#
濡傛灉鏄痽um錛宺pm瀹夎呯殑杞浠訛細鐢眗pm鍖呬腑鐨勮剼鏈鍒涘緩鏈嶅姟璐︽埛
Includeconf.moles.d/*.conf
#
#,youmustrun
#.
#
#User/Group:Thename(or#number)oftheuser/grouptorunhttpdas.
#
#runninghttpd,aswithmostsystemservices.
#
Userapache
Groupapache
#'Main'serverconfiguration
#
鏈鍦扮粍錛
1錛変富緇勶細涓涓鐢ㄦ埛涓瀹氳佸睘浜庢煇涓涓葷粍涓銆傚綋浜涚敤鎴峰湪鍒涘緩鏂囦歡鏃訛紝緇欐枃浠剁殑褰掑睘緇
2錛変粠灞炵粍錛氱敤鎴峰瑰櫒錛岀粍緇囧拰綆$悊鐢ㄦ埛鏉冮檺綆℃帶
浣滅敤錛
鏂囦歡錛
榪涚▼錛
$ps-ux
USERPID%CPU%
student321780.00.4930529360?Ss15:000:00/usr/lib/system
student321820.00.32537767072?S15:000:00(sd-pam)
student321880.00.21594124980?S15:000:00sshd:student@p
student321890.00.22339124864pts/0Ss15:000:00-bash
student322930.30.21594085192?D15:430:00sshd:student@p
student322940.30.22339124924pts/1Ss15:430:00-bash
student323190.50.22339404804pts/1S15:430:00/bin/bash
student323410.00.22693123876pts/1R+15:430:00ps-ux
$
璐︽埛鏂囦歡錛
1錛/etc/passwd:淇濆瓨鐢ㄦ埛淇℃伅
#cat/etc/passwd|grepstudent
student:x:1000:1000:StudentUser:/home/student:/bin/bash
鐢ㄦ埛鍚嶅瘑鐮乽id涓葷粍ID鎻忚堪瀹剁洰褰曠櫥褰晄hell
#
#cat/etc/passwd|grep-wroot:x
root:x:0:0:root:/root:/bin/bash
#
#cat/etc/passwd|grepapache
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
鏈嶅姟璐﹀彿鏃犳硶鐧誨綍緋葷粺
#
2./etc/shadow錛氫繚瀛樼敤鎴峰瘑鐮佺殑HASH錛屽瘑鐮佺殑鏈夋晥鎬т俊鎮錛屽瘑鐮佷慨鏀規椂闂達紝璐︽埛鏈夋晥鏈熴
#
#ls-l/etc/shadow
----------.1rootroot1014Mar2911:39/etc/shadow
#
#
#cat/etc/shadow|grepstudent
student:$6$8oIjLCsc$/n1iQXYh1E6./eMij2uHM/a1tue/QRlo3X80:18038:0:99999:7:::
#
瀵嗙爜鐨凥ASH:sha512
8oIjLCsc$/n1iQXYh1E6./eMij2uHM/a1tue/QRlo3X80
18038:澶╂暟瀵嗙爜鏈鍚庝竴嬈′慨鏀圭殑鏃墮棿浠1970-01-01+18038澶╀箣鍚庨偅涓澶
0錛氬瘑鐮佹渶灝戜嬌鐢ㄥぉ鏁0娌℃湁闄愬埗鐢ㄦ埛闅忔椂鍙浠ユ敼瀵嗙爜
99999錛氬ぉ鏁幫紝瀵嗙爜鏈澶т慨鏀規椂闂存案涔200澶氬勾
7錛歸arning璀﹀憡鏃墮棿錛屽綋瀵嗙爜蹇鍒版渶鍚庝慨鏀規椂闂村墠7澶╋紝閫氱煡鐢ㄦ埛淇鏀廣
::澶╂暟澶辨晥鏃墮棿inactive鐢ㄦ埛瀵嗙爜榪囦簡鏈鍚庝慨鏀規椂闂達紝鏈鏀瑰彉瀵嗙爜錛屽啀榪囧氬皯澶╋紝璐︽埛灝嗚閿佸畾
::璐︽埛鏈夋晥鏈
鍒涘緩鐢ㄦ埛鍜岀粍錛
鍒涘緩鏃訛紝娌℃湁瀵嗙爜錛
#useraddzhangsan
#useraddlisi
#idzhangsan
uid=1001(zhangsan)gid=1001(zhangsan)groups=1001(zhangsan)
#idlisi
uid=1002(lisi)gid=1002(lisi)groups=1002(lisi)
#
鏃犳硶鐧誨綍錛氫笌PAM鏈夊叧
$
$su-zhangsan
Password:
Password:
su:Authenticationfailure
$
璁劇疆瀵嗙爜錛
#
#cat/etc/passwd|grepzhangsan
zhangsan:x:1001:1001::/home/zhangsan:/bin/bash
#cat/etc/shadow|grepzhangsan
zhangsan:!!:18350:0:99999:7:::#!!鏈璁劇疆瀵嗙爜
#
#passwdzhangsan
.
Newpassword:
BADPASSWORD:
Retypenewpassword:
passwd:.
#
#
#cat/etc/shadow|grepzhangsan
zhangsan:$6$3wxuXomVbQ58wQcK$oQW6injgldxa2N/Pt4tCPDVRqWRVGw.UNZdxE4R0nhEt8K/3UDKzxap6ReIReEvDpG.GdwjpMiiDh7.f6DJNQ0:18350:0:99999:7:::
#
chage鍙浠ユ煡鐪嬬敤鎴峰瘑鐮佸睘鎬
#chage-lzhangsan
Lastpasswordchange:Mar29,2020
Passwordexpires:never
Passwordinactive:never
Accountexpires:never
:0
:99999
:7
#
鍒涘緩緇勶細浠庡睘緇
#
#groupaddit
#
#
#groupaddsales
#
#
#
#cat/etc/group
root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mem:x:8:
kmem:x:9:
wheel:x:10:student
cdrom:x:11:
mail:x:12:postfix
man:x:15:
dialout:x:18:
floppy:x:19:
games:x:20:
tape:x:33:
video:x:39:
ftp:x:50:
lock:x:54:
audio:x:63:
users:x:100:
nobody:x:65534:
dbus:x:81:
utmp:x:22:
utempter:x:35:
input:x:999:
kvm:x:36:
render:x:998:
systemd-journal:x:190:
systemd-coremp:x:997:
systemd-resolve:x:193:
tss:x:59:
polkitd:x:996:
rpc:x:32:
unbound:x:995:
ssh_keys:x:994:
sssd:x:993:
setroubleshoot:x:992:
rpcuser:x:29:
insights:x:991:
cockpit-ws:x:990:
sshd:x:74:
chrony:x:989:
tcpmp:x:72:
student:x:1000:
printadmin:x:988:
libstoragemgmt:x:987:
slocate:x:21:
postdrop:x:90:
postfix:x:89:
apache:x:48:
zhangsan:x:1001:
lisi:x:1002:
it:x:1003:緇勬垚鍛樺垪琛
sales:x:1004:
#
#idstudent
uid=1000(student)gid=1000(student)groups=1000(student),10(wheel)
#
灝嗙敤鎴鋒坊鍔犺繘緇勶細zhangsan,鍔犲叆it緇勶紝lisi錛宻ales緇
#idstudent
uid=1000(student)gid=1000(student)groups=1000(student),10(wheel)
#usermod-aGitzhangsan
#
#
#usermod-aGsaleslisi
#
#
#idzhangsan
uid=1001(zhangsan)gid=1001(zhangsan)groups=1001(zhangsan),1003(it)
#idlisi
uid=1002(lisi)gid=1002(lisi)groups=1002(lisi),1004(sales)
#
鍒犻櫎鐢ㄦ埛錛
#useraddandy
榛樿ゅ垹闄わ紝淇濈暀鐢ㄦ埛鐨勬枃浠訛細
#
#userdelandy
#
#
#useraddandy#閲嶅緩andy浼氫笉涓鏍鳳紝uid浼氫笉鍚
useradd:warning:thehomedirectoryalreadyexists.
.
Creatingmailboxfile:Fileexists
#
#useradser1
#useradser2
#idandy
uid=1003(andy)gid=1005(andy)groups=1005(andy)
#userdel-rany
userdel:user'any'doesnotexist
#
#userdel-randy#涓嶄繚鐣欑敤鎴風殑鏂囦歡銆傚剁洰錛岄偖綆辨枃浠訛紝skel鏂囦歡閮戒細
#
#
#idandy
id:鈥榓ndy鈥:nosuchuser
#useraddandy
#idandy
uid=1006(andy)gid=1008(andy)groups=1008(andy)
#
浠庣粍涓縐婚櫎鐢ㄦ埛錛
#
#idzhangsan
uid=1001(zhangsan)gid=1001(zhangsan)groups=1001(zhangsan),1003(it)#zhangsan涓葷粍錛宨t浠庡睘緇
#
鍛戒護錛
#gpasswd-dzhangsanit
#
#
#idzhangsan
uid=1001(zhangsan)gid=1001(zhangsan)groups=1001(zhangsan)
#
#
#usermod-aGitzhangsan
#
#
#idzhangsan
uid=1001(zhangsan)gid=1001(zhangsan)groups=1001(zhangsan),1003(it)
#
#
#
#groupszhangsan
zhangsan:zhangsanit
#
鐩存帴淇鏀規枃浠訛細
#vim/etc/group
#cat/etc/group|grepit:
it:x:1003:
#
鍒犻櫎緇勶細
#groupaddtest
#
#
#groupdeltest
鍒涘緩鑷瀹氫箟鐢ㄦ埛鍜岀粍錛
瀹為獙錛氱敤鎴峰悕mary,鎸囧畾鐢ㄦ埛id2000,瀹剁洰褰/maryhome,涓嶇敤鐧誨綍緋葷粺鎻忚堪thisismaryuser
#
#useradd-u2000-d/maryhome-s/sbin/nologin-c"thisismary"mary
#
#idmary
uid=2000(mary)gid=2000(mary)groups=2000(mary)
#cat/etc/passwd|grepmary
mary:x:2000:2000:thisismary:/maryhome:/sbin/nologin
#
#su-mary
Lastlogin:SunMar2916:48:49CST2020onpts/0
.
#
鍒涘緩鑷瀹氫箟緇勶細鎸囧畾緇剗d
#groupadd-g3000group1
#cat/etc/group|grepgroup1
group1:x:3000:
#
linux濡備綍鏌ョ湅緇勬槸鍚︽坊鍔犳垚鍔燂紵
鏈夊氱嶆柟娉曪細
1銆佺洿鎺ユ煡/etc/passwd,/etc/group錛坓rep鍛戒護鏌ワ級
2銆乽sers鍜実roups鍛戒護鍒嗗埆鎵撳嵃緋葷粺涓鐨勫叏閮ㄧ敤鎴峰拰緇勩
3銆乮d鍛戒護鏌ョ敤鎴
涓插彛鎺у埗鍙板備綍鎵撳紑linux緇堢鎺у埗鍙幫紵
涓插彛鎺у埗鍙版墦寮linux緇堢鎺у埗鍙扮殑鏂規硶鏄榪藉姞鎵撳紑鍛戒護鐨勮岋紝涓轟簡灝嗚繖浜涗俊鎮鏄劇ず鍦ㄧ粓絝涓婏紝鍙浠ュ皢榪欎簺鏂囦歡涓鍚鏈塭cho鍛戒護鐨勮岃拷鍔>TTY銆俆TY鏄緇堢鐨勪覆鍙(涓/etc/inittab涓涓插彛緇堢琛岀殑涓鏍)銆
鍊煎緱娉ㄦ剰鐨勬槸錛岃繖鏍峰仛鐨勫ソ澶勬槸鍒╃敤涓插彛緇堢浣滀負Linux鎺у埗鍙幫紝鍙浠ュ厤鍘婚濆栫殑閿鐩橈紝鏄劇ず鍗″拰鏄劇ず鍣錛屽悓鏃跺彲灝哃inux涓繪満浣滀負涓涓浠繪剰鐢ㄩ旂殑宓屽叆寮忛粦鍖c
鍏蜂綋鐨勬搷浣滄柟娉曟槸錛屽湪鏂囦歡/etc/inittab澧炲姞涓嬮潰涓琛屻
ID:RUNLEVELS:respawn:/sbin/agetty-LSPEEDTTYTERM銆
榪欓噷錛欼D=涓ゅ瓧姣嶇殑鏍囪瘑絎︼紝濡俿1鎴杝2銆俁UNLEVELS=緇堢嬋媧葷殑榪愯岀駭鍒銆係PEED=涓插彛絝鍙i熺巼銆俆TY=涓插彛鐨勮懼囧悕銆俆ERM=TERM鐜澧冨彉閲忋傝寖渚嬪備笅s2:12345:respawn:/sbin/agetty-L9600ttyS1vt100錛岃〃紺轟覆鍙/dev/ttyS1(COM2)閫熺巼涓9600bps錛岀粓絝妯″紡涓簐t100銆