终端自动注销
闲置600秒后自动注销
vim ~/.bash_profile
//在行尾添加下面的环境变量
export TMOUT=600
使用su命令切换用户
用途及用法
用途:Substitute User,切换用户
格式:su - 目标用户
密码验证
root → 任意用户, 不验证密码 普通用户 → 其他用户,验证目标用户的密码
su - root
密码:
whoami
root
限制使用su命令的用户
启用pam_wheel认证模块
将允许使用su命令的用户加入wheel组
vim /etc/pam.d/su
//找到下面行,将“#”号删掉
#auth required pam_wheel.so use_uid
gpasswd -a likui wheel
正在将用户“ceshi”加入到“wheel”组中
使用sudo机制提升权限
用途及用法
用途:以其他用户身份(如root)执行授权的命令
用法:sudo 授权命令
密码验证
初次执行sudo命令时,验证当前用户的密码
不需验证目标用户的密码
sudo -u likui /bin/touch /tmp/test
ll /tmp
-rw-r--r--. 1 likui likui 0 5月 31 10:51 test15:55 test
使用sudo机制提升权限
配置sudo授权
visudo 或者 vim /etc/sudoers
记录格式:用户 主机名列表=命令程序列表
[root@localhost ~]# vim /etc/sudoers
root ALL=(ALL) ALL
%wheel ALL=(ALL) ALL
[likui@localhost 桌面]$ sudo ifconfig
使用sudo机制提升权限
配置sudo授权
例:将likui加入/etc/sudoers,授权
vim /etc/sudoers
likui localhost=/sbin/*,!/sbin/ifconfig,!/sbin/route
Cmnd_Alias PKGTOOLS=/bin/rpm,/usr/bin/yum
User_Alias LUSERS=likui,ligui,liwei
Host_Alias LHOSTS=localhost,host1,host2
LUSERS LHOSTS=PKGTOOLS
sudo /sbin/ifconfig
对不起,用户 likui 无权以 root 的身份在 localhost 上执行 /sbin/ifconfig。
sudo /sbin/ip addr
sudo -l
|
Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu |
|
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu |
|
|
|
|
|
Text-to-speech function is limited to 200 characters