LoginSignup
2
1

More than 5 years have passed since last update.

Linuxで突如ユーザーにログインできなくなった話

Last updated at Posted at 2018-06-03

突然エラーが出た

ユーザーにログインしようとすると以下のエラー。

Terminal
segmentation fault

やったこと

ルートでログインし、testというユーザーを作成する。

Terminal
$ su
# useradd test

新規ユーザーの.bashrcをそのままコピーする。

.bashrc
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

元ユーザーの.bashrcがおかしい

.bashrc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

それを以下のように記述する。

.bashrc
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

おまけ

.bash_profile

.bash_profileを変更してrbenvコマンドを使えるようにする。

.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

rbenvがあるパスを指定。

.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
2
1
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
2
1