① 怎么在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銆