0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Linux 初期設定] sudo対処タイムアウト時間を変更

Last updated at Posted at 2023-09-08

Linux 初期設定シリーズ

変更内容:sudo対処タイムアウト時間をデフォルトの5分から60分に変更
確認OS:Red Hat Enterprise Linux release 9.2 (Plow)
対象ファイル:/etc/sudoers
反映:即時

1.設定ファイルのバックアップ

test.sh
sudo cp -an /etc/sudoers{,.$(date +%Y%m%d)}
sudo ls -alF /etc/sudoers*

2.タイムアウト時間の変更

test.sh
echo "Defaults    timestamp_timeout = 60" | sudo EDITOR='tee -a' visudo > /dev/null

3.設定の確認

test.sh
sudo grep timestamp_timeout /etc/sudoers
sudo diff /etc/sudoers{,.$(date +%Y%m%d)}

その他.設定の解除
※echo コマンドを複数回実行してしまった場合にも使える

test.sh
sudo sed -e '/timestamp_timeout/d' /etc/sudoers | sudo EDITOR=tee visudo > /dev/null
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?