問題
ユーザーが korn シェル (ksh) を使用して端末にログインすると、次のメッセージが表示されます:
Shopt: Not Found [No Such File Or Directory]
解決策
次の行が /etc/profile に追加されました :
shopt -s histappend
注意 :
/etc/profile すべてのユーザーのグローバル環境を設定する構成ファイルです。 shopt の man ページによると:
# man shopt shopt is part of BASH_BUILTINS -s Display readline key sequences bound to macros and the strings they output in such a way that they can be re-read. histappend If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file
shopt は BASH_BUILTINS の一部であるため、問題は KSH にあります。 . /etc/passwd に従って ユーザー シェルが「bash」ではなく「ksh」であるファイル:
# grep -i test /etc/passwd testuserX:x:54322:54323::/home/testuserX:/bin/bash test1:x:54323:112::/home/test1:/bin/ksh
==============
/etc/profile :
==============
47 TMOUT=14400 48 HOSTNAME=`/bin/hostname 2>/dev/null` 49 HISTSIZE=1000 50 HISTTIMEFORMAT='%F.%T ' 51 shopt -s histappend <=============================== Line was added
ユーザーテストに切り替えると、次のメッセージが表示されます:
# su - test1 /etc/profile[277]: shopt: not found [No such file or directory]
解決策 1
1. ファイル /etc/profile を編集し、コメント行 51:shopt -s histappend:
# vi /etc/profile #shopt -s histappend
2. プロファイルをリロードするか、ターミナルを終了して再度ログインします。
# source /etc/profile .
3. 再度ログイン:
# su - test1 $ $ whoami test1注意 :root などの特定のユーザーに対してこの行 shopt -s histappend を使用する必要がある場合は、root ユーザーまたはデフォルトとして bash を使用しているその他のユーザーの bash_profile でそのオプションを使用することをお勧めします。
例:
# cat /root/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi
ユーザー固有の環境とスタートアップ プログラム:
PATH=$PATH:$HOME/bin shopt -s histappend export PATH export HISTTIMEFORMAT="%
/etc/profile から削除します:
# cat /etc/profile| grep -i shopt #
解決策 2
ユーザー test1 のシェルを ksh から bash に変更します。
1. 現在のシェルを確認します:
# chsh -l test1 /bin/sh /bin/bash /sbin/nologin /bin/dash /bin/tcsh /bin/csh /bin/ksh
2.bashに変更
# chsh -s /bin/bash test1 Changing shell for test1. Shell changed.
# cat /etc/passwd|grep -i test1 test1:x:54323:112::/home/test1:/bin/bash #
3. 新しいシェルを確認してテストします:
# su - test1 $ whoami test1 $
「530 非匿名セッションは暗号化を使用する必要があります」 – curl の使用中
vmstat、sar、iostat、および mpstat を使用して基本的なシステム パフォーマンスを分析する方法