安装数据库的时候我们需要用oracle用户,可是今天创建oracle用户,切换过去有一个警告信息。
rac01:~ # su - oracle
su: warning: cannot change directory to /home/oracle: No such file or directory
以前创建没有遇到过这个问题。
原来这是因为我的系统是
SUSE Linux Enterprise Server 11
在SUSE系统下创建用户 时要加 -m 参数才会给新用户创建/home目录
/etc/login.defs 的文件内容如下
# /etc/login.defs - Configuration control definitions for pwdutils package.
#
# Comment lines (lines beginning with "#") and blank lines are ignored.
# Please read the manual page for more information (login.defs.5).
#
#
# Should login be allowed if we can't cd to the home directory?
# Default is yes.
#
DEFAULT_HOME yes
#
# The default PATH settings (used by login):
#
ENV_PATH /usr/local/bin:/usr/bin:/bin
#
# The default PATH settings for root (used by login):
#
ENV_ROOTPATH /sbin:/bin:/usr/sbin:/usr/bin
#
# Delay in seconds before being allowed another attempt
# after a login failure
#
FAIL_DELAY 3
#
# If defined, file which inhibits all the usual chatter
# during the login sequence. If a full pathname, then hushed
# mode will be enabled if the user's name or shell are found
# in the file. If not a full pathname, then hushed mode will
# be enabled if the file exists in the user's home directory.
#
#HUSHLOGIN_FILE .hushlogin
HUSHLOGIN_FILE /etc/hushlogins
#
# Enable logging and display of /var/log/lastlog login time info.
#
LASTLOG_ENAB yes
#
# Enable display of unknown usernames when login failures
# are recorded.
#
LOG_UNKFAIL_ENAB no
#
# Max number of login retries if password is bad
# This variable is deprecated and will be removed with the next version.
#
LOGIN_RETRIES 3
和redhat的有区别,没有CREATE_HOME这个参数
将CREATE_HOME yes 这个参数加入到文件中去,再去创建用户 ,依然没有自动创建/home 目录
rac01:~ # su - test
su: warning: cannot change directory to /home/test: No such file or directory