sudo密码超时设置,避免短时间内多次输入
sudo
是Linux下进行提权操作的授权程序,在经由管理员设置账户允许使用sudo
后。那些需要root
权限的操作,只需在命令前添加sudo
,完成账户密码验证,相关操作即会以root
权限运行。在这过程中,若要以不连续方式运行多条命令(间隔超过5分钟),sudo
程序会要求重新输入密码验证。
这是sudo
的一种安全机制,当用户成功使用sudo
会生成一条记录。其中包含时间戳、用户ID、终端会话ID,之后5分钟内再次使用将无需输入密码。这个时间可以自定义设置,具体方法如下。
设置方法
1. 运行下面命令修改/etc/sudoers
配置文件。需确保操作账户具有修改权限,wheel
组账户可以满足要求,没有请切换root
身份操作。
sudo visudo
注意不要用其它编辑器修改文件,因为可能存在语法问题,visudo
会在保存时检查语法是否正确。
2. 打开文件后操作方法和vi
编辑器一样(Ubuntu则是nano
),在文件最后添加一行,内容如下。
Defaults:username timestamp_timeout=20
蓝色字符是账户名,红色是sudo
密码缓存时长,单位分钟。若设置0
,则每次操作都要密码确认。
如果文件内存在多条设置规则,后面的规则会覆盖先前的规则。
3 平时用完sudo
后可以通过sudo -k
命令清除密码缓存,使其重新开始计时。另外在不进行实际操作情况下,可以用sudo -v
命令开始缓存。
结束语
虽然也可以直接关闭密码验证,一了百了解决问题。但这样会减低安全性,不建议也没有必要。如果需要长时间无密码操作,可以用sudo su
或sudo -s
命令临时切换root
操作,退出用exit
命令。
对于某些常用的操作,例如systemctl
之类的,还可以创建NOPASSWD
规则设置部分操作不要密码验证。具体可见man
文档介绍。
Hi, very nice website, cheers!
——————————————————
Need cheap and reliable hosting? Our shared plans start at $10 for an year and VPS plans for $6/Mo.
——————————————————
Check here: https://www.reliable-webhosting.com/
average cost of cialis prescription https://buszcentrum.com/
acyclovir 250 mg tablet https://www.herpessymptomsinmen.org/productacyclovir/
lumigan coupons from allergan https://carepro1st.com/
clomid ingredients vs clomiphene ingredients https://salemeds24.wixsite.com/clomid
generic tadalafil united states http://www.lm360.us/
silagra long term safety https://silagra.buszcentrum.com/
blue pill suhagra from mexico https://suhagra.buszcentrum.com/
is ivermectin poison https://ivermectin.webbfenix.com/
plaquenil hydroxychloroquine for lupus https://hhydroxychloroquine.com/
usa vidalista https://vidalista.mlsmalta.com/
hydroxychloroquine for osteoarthritis https://hydroxychloroquine.webbfenix.com/
order hydroxychloroquine https://hydroxychloroquine.mlsmalta.com/
ivermectin pills cvs https://ivermectin.mlsmalta.com/
overnight delivery viagra http://droga5.net/
generic cialis fda approved https://wisig.org/
taking cialis and viagra https://tadalafili.com/
viagra or vidalista jovidalistarl https://vidalista40mg.mlsmalta.com/
dexamethasone 0.75 mg
salbutamol inhaler dosage https://amstyles.com/
mobic tabs
161510 aspirin
nationwide car insurance quote
loan b
car insurance compare
free adult cams
prescription free canadian pharmacy
how much is cialis 20mg
how is hydroxychloroquine made https://hydroxychloroquinee.com/
fast loans
homeowners insurance quotes florida
dapoxetine users testimonials https://ddapoxetine.com/
property insurance
cialis online pharmacy paypal
margin loan
average home insurance cost by zip code
lasix rx
homeowner insurance
hydroxychloroquine interaction https://sale.azhydroxychloroquine.com/
professional generic cenforce 100mg http://cavalrymenforromney.com/
medication for marijuana addiction https://edmeds.buszcentrum.com/
medication for marijuana addiction https://buymeds.mlsmalta.com/
does female dapoxetine work https://dapoxetine.confrancisyalgomas.com/
cialis samples for physicians office http://cleckleyfloors.com/
how to take liquid cialis https://cialzi.com/
cialis cost generic https://tadalafil.cleckleyfloors.com/
best generic cialis review http://ciaalis2u.com/
vidalista prescription http://vidallista.com/
prescription refill no insurance https://medpills.bee-rich.com/
aurogra vs tadalafil pah https://aurogra.buszcentrum.com/
ivermectin without prescription http://ivermmectin.com/
tadalafil and cialis sales https://cialis.buszcentrum.com/
tadalafil and cialis sales https://cialis.lm360.us/
directions for taking viagra 100mg http://viaagra1.com/
generic tadalafil without doctor visit https://atadalafil.online/
buy viagra 100mg without script http://viiagra.co/
Hello i am kavin, its my first time to commenting anywhere, when i read this
article i thought i could also create comment due to this brilliant paragraph. http://cleckleyfloors.com/viagra
Hi there everybody, here every one is sharing these familiarity, thus it’s
nice to read this webpage, and I used to go to see
this weblog everyday. https://cialis.advantagetriseal.com/tadalafil
It’s very trouble-free to find out any matter
on net as compared to textbooks, as I found this paragraph at this
web site. https://hydroxychloroquineb.bee-rich.com/
Article writing is also a fun, if you be familiar with then you can write or else it is complex to write. https://hydroxychloroquines.studiowestinc.com/
Hello, Neat post. There is an issue with your site in internet explorer, may check thisK IE nonetheless is the marketplace leader and a large section of people will leave out your fantastic writing due to this problem.
http://www.vreyrolinomit.com/