科普Solaris系統(tǒng)安全常用命令小結
更新時間:2008年06月07日 22:26:50 作者:
Solaris系統(tǒng)下維護密碼和登錄控制 監(jiān)控系統(tǒng)使用情況
限制文件訪問 root用戶登錄 控制通過網絡的遠程訪問
作者:amxku
來源:amxku's blog
==維護密碼和登錄控制
pwconv命令:使用/etc/passwd文件的信息創(chuàng)建和升級/etc/shadow文件。
如果系統(tǒng)中/etc/shadow文件不存在,使用/etc/passwd文件信息創(chuàng)建/etc/shadow文件。
如果系統(tǒng)中/etc/shadow文件存在,執(zhí)行如下操作:
存在在/etc/passwd文件但不存在在/etc/shadow文件中的用戶將被增加到/etc/shadow文件中。
存在在/etc/shadow文件但不存在在/etc/passwd文件中的用戶將被從/etc/shadow文件中刪除。一般我們會在用名后面加上*LK*來鎖定該用戶。
==監(jiān)控系統(tǒng)使用情況
顯示系統(tǒng)中登錄的用戶
# who (調用/var/adm/utmpx文件中的信息)
顯示系統(tǒng)中登錄的用戶的詳細信息
# finger username
# finger username@remotehostname
-m:僅僅匹配用戶名
顯示系統(tǒng)中所有登錄活動的記錄
# last (調用/var/adm/wtmpx文件中的信息)
# last username
# last reboot
顯示遠程系統(tǒng)中登錄的用戶
# rusers -l
==改變文件權限
chown命令:用于改變文件的屬主
命令格式:chown [ option(s) ] user_name filename(s)
chown [ option(s) ] UID filename(s)
例如:
# chown user2 file7
# chown -R user2 dir4
# chown user3:class file2
# chown -R user3:class dir1 chgrp命令:用于改變文件的數組
命令格式:chgrp groupname filename(s)
chgrp GID filename(s)
例如:
# chgrp class file4 ==Root 用戶登錄
直接使用root用戶名登錄,輸入root用戶的密碼。
使用普通用戶登錄,然后調用su命令轉變?yōu)閞oot用戶。
su命令:允許用戶不用登錄就可以改變成另外一個用戶。
命令格式:su [ - ] [ username ]
root用戶可以不需要密碼使用su命令轉換到其它任何用戶。
除root用戶外,其它任何用戶使用su命令轉換時都必須首先知道轉換后的用戶的密碼。
-:執(zhí)行一個完整登錄。根據創(chuàng)建用戶時設定的配置文件來改變用戶工作環(huán)境。
管理用戶訪問
/etc/default/su
/etc/default/login
/etc/default/passwd # more su
#ident "@(#)su.dfl 1.6 93/08/14 SMI" /* SVr4.0 1.2 */
# SULOG determines the location of the file used to log all su attempts
SULOG=/var/adm/sulog
# CONSOLE determines whether attempts to su to root should be logged
# to the named device
#CONSOLE=/dev/console
# PATH sets the initial shell PATH variable
#PATH=/usr/bin:
# SUPATH sets the initial shell PATH variable for root
#SUPATH=/usr/sbin:/usr/bin
# SYSLOG determines whether the syslog(3) LOG_AUTH facility should be used
# to log all su attempts. LOG_NOTICE messages are generated for su's to
# root, LOG_INFO messages are generated for su's to other users, and LOG_CRIT
# messages are generated for failed su attempts.
SYSLOG=YES # more login
#ident "@(#)login.dfl 1.10 99/08/04 SMI" /* SVr4.0 1.1.1.1 */
# Set the TZ environment variable of the shell.
#
#TIMEZONE=EST5EDT
# ULIMIT sets the file size limit for the login. Units are disk blocks.
# The default of zero means no limit.
#
#ULIMIT=0
# If CONSOLE is set, root can only login on that device.
# Comment this line out to allow remote login by root.
#
CONSOLE=/dev/console 限制root訪問
CONSOLE=/dev/console
Root用戶只能在console口上登錄,任何其它的root用戶登錄都將報錯。
# CONSOLE=/dev/console
Root用戶能夠從任何設備上登錄,包括網絡、Modem、其它終端等。
CONSOLE=
Root用戶不能從任何地方登錄。要成為root用戶只有一個辦法,首先使用普通用戶登錄,然后使用su命令轉換為root用戶。切記,在禁用root遠程登錄之前一定要確保系統(tǒng)里還有其它的用戶可以登錄。不然就會出現(xiàn)驚險的Solaris加固過程[http://www.amxku.net/archives/reinforcement-solaris/]。
用戶密碼策略
# more passwd
#ident "@(#)passwd.dfl 1.3 92/07/14 SMI"
MAXWEEKS=27 #密碼最長存活周期
MINWEEKS=1 #密碼最短存活周期
PASSLENGTH=8 #密碼長度最小值
MINALPHA=2 ;MINNONALPHA=1 #至少包括兩個字母和一個非字母
# 注意:/etc/shadow文件中設置的時間優(yōu)先級高于/etc/default/passwd文件中設置的時間
管理遠程訪問
/etc/hosts.equiv 文件
$HOME/.rhosts 文件
/etc/ftpusers 文件 ==遠程訪問流程

amxku_at_msn.com
給用戶培訓時寫的一個文檔。個人拙見,有不妥之處還望斧正。
amxku_at_msn.com
給用戶培訓時寫的一個文檔。個人拙見,有不妥之處還望斧正。
來源:amxku's blog
==維護密碼和登錄控制
pwconv命令:使用/etc/passwd文件的信息創(chuàng)建和升級/etc/shadow文件。
如果系統(tǒng)中/etc/shadow文件不存在,使用/etc/passwd文件信息創(chuàng)建/etc/shadow文件。
如果系統(tǒng)中/etc/shadow文件存在,執(zhí)行如下操作:
存在在/etc/passwd文件但不存在在/etc/shadow文件中的用戶將被增加到/etc/shadow文件中。
存在在/etc/shadow文件但不存在在/etc/passwd文件中的用戶將被從/etc/shadow文件中刪除。一般我們會在用名后面加上*LK*來鎖定該用戶。
==監(jiān)控系統(tǒng)使用情況
顯示系統(tǒng)中登錄的用戶
# who (調用/var/adm/utmpx文件中的信息)
顯示系統(tǒng)中登錄的用戶的詳細信息
# finger username
# finger username@remotehostname
-m:僅僅匹配用戶名
顯示系統(tǒng)中所有登錄活動的記錄
# last (調用/var/adm/wtmpx文件中的信息)
# last username
# last reboot
顯示遠程系統(tǒng)中登錄的用戶
# rusers -l
==改變文件權限
chown命令:用于改變文件的屬主
命令格式:chown [ option(s) ] user_name filename(s)
chown [ option(s) ] UID filename(s)
例如:
# chown user2 file7
# chown -R user2 dir4
# chown user3:class file2
# chown -R user3:class dir1 chgrp命令:用于改變文件的數組
命令格式:chgrp groupname filename(s)
chgrp GID filename(s)
例如:
# chgrp class file4 ==Root 用戶登錄
直接使用root用戶名登錄,輸入root用戶的密碼。
使用普通用戶登錄,然后調用su命令轉變?yōu)閞oot用戶。
su命令:允許用戶不用登錄就可以改變成另外一個用戶。
命令格式:su [ - ] [ username ]
root用戶可以不需要密碼使用su命令轉換到其它任何用戶。
除root用戶外,其它任何用戶使用su命令轉換時都必須首先知道轉換后的用戶的密碼。
-:執(zhí)行一個完整登錄。根據創(chuàng)建用戶時設定的配置文件來改變用戶工作環(huán)境。
管理用戶訪問
/etc/default/su
/etc/default/login
/etc/default/passwd # more su
#ident "@(#)su.dfl 1.6 93/08/14 SMI" /* SVr4.0 1.2 */
# SULOG determines the location of the file used to log all su attempts
SULOG=/var/adm/sulog
# CONSOLE determines whether attempts to su to root should be logged
# to the named device
#CONSOLE=/dev/console
# PATH sets the initial shell PATH variable
#PATH=/usr/bin:
# SUPATH sets the initial shell PATH variable for root
#SUPATH=/usr/sbin:/usr/bin
# SYSLOG determines whether the syslog(3) LOG_AUTH facility should be used
# to log all su attempts. LOG_NOTICE messages are generated for su's to
# root, LOG_INFO messages are generated for su's to other users, and LOG_CRIT
# messages are generated for failed su attempts.
SYSLOG=YES # more login
#ident "@(#)login.dfl 1.10 99/08/04 SMI" /* SVr4.0 1.1.1.1 */
# Set the TZ environment variable of the shell.
#
#TIMEZONE=EST5EDT
# ULIMIT sets the file size limit for the login. Units are disk blocks.
# The default of zero means no limit.
#
#ULIMIT=0
# If CONSOLE is set, root can only login on that device.
# Comment this line out to allow remote login by root.
#
CONSOLE=/dev/console 限制root訪問
CONSOLE=/dev/console
Root用戶只能在console口上登錄,任何其它的root用戶登錄都將報錯。
# CONSOLE=/dev/console
Root用戶能夠從任何設備上登錄,包括網絡、Modem、其它終端等。
CONSOLE=
Root用戶不能從任何地方登錄。要成為root用戶只有一個辦法,首先使用普通用戶登錄,然后使用su命令轉換為root用戶。切記,在禁用root遠程登錄之前一定要確保系統(tǒng)里還有其它的用戶可以登錄。不然就會出現(xiàn)驚險的Solaris加固過程[http://www.amxku.net/archives/reinforcement-solaris/]。
用戶密碼策略
# more passwd
#ident "@(#)passwd.dfl 1.3 92/07/14 SMI"
MAXWEEKS=27 #密碼最長存活周期
MINWEEKS=1 #密碼最短存活周期
PASSLENGTH=8 #密碼長度最小值
MINALPHA=2 ;MINNONALPHA=1 #至少包括兩個字母和一個非字母
# 注意:/etc/shadow文件中設置的時間優(yōu)先級高于/etc/default/passwd文件中設置的時間
管理遠程訪問
/etc/hosts.equiv 文件
$HOME/.rhosts 文件
/etc/ftpusers 文件 ==遠程訪問流程

amxku_at_msn.com
給用戶培訓時寫的一個文檔。個人拙見,有不妥之處還望斧正。
amxku_at_msn.com
給用戶培訓時寫的一個文檔。個人拙見,有不妥之處還望斧正。
相關文章
linux通過掛載系統(tǒng)光盤搭建本地yum倉庫的方法
linux通過掛載系統(tǒng)光盤搭建本地yum倉庫,使用yum命令加上 list 參數就可以查看倉庫了。本文介紹的非常詳細,具有參考借鑒價值,感興趣的朋友一起看看吧2016-10-10Linux實現(xiàn)301重定向和偽靜態(tài)方法
本篇文章給大家整理了在Linux實現(xiàn)301重定向和偽靜態(tài)方法以及注意事項,對此有需要的朋友可以參考學習下。2018-04-04詳解Ubuntu16.04下Hadoop 2.7.3的安裝與配置
本篇文章主要介紹了詳解Ubuntu16.04下Hadoop 2.7.3的安裝與配置,具有一定的參考價值,有興趣的可以了解一下。2017-01-01