プロが教える店舗&オフィスのセキュリティ対策術

Centos7の
/etc/profileがおかしくなりエラーがでて正常に動作しないため
困っております.ご教授よろしくお願いします。

エラー

-bash: /etc/profile: Permission denied
-bash: /etc/profile: line 26: syntax error near unexpected token `then'
-bash: /etc/profile: line 26: ` o $ORACLE_HOME f [ -z "$EUID" ]; then'

/etc/profile 内容

/etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}


if [ -x /usr/bin/id ]; then
o $ORACLE_HOME f [ -z "$EUID" ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /usr/sbin pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZ=E1000
rt CLASSPATH=$CLASSPATH:
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ish: /etc/profile: line 13: syntax error near unexpected token `('
-bash: /etc/profile: line 13: `pathmunge () {'
gnoreboth
else
export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
pathmunge () {
case ":${PATH}:" in
fi

for i in /etc/profile.d/*.sh ; do
if [ -r f [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done

unset i
unset -f pathmunge

$ . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=American_Japan.UTF8
export PATH=$PATH:$ORACLE_HOME/bin

A 回答 (1件)

複数個所が壊れています。


最後の6行以外は標準のままのようです。

下記コマンドを実行したら標準ファイルが /tmp/setup-*.noarch/etc/profile に展開されるので、それを基に復元すればよいです。

yum install yum-utils rpmdevtools
cd /tmp
yumdownloader setup
rpmdev-extract setup-*.noarch.rpm
    • good
    • 1
この回答へのお礼

助かりました

回答ありがとうございます。

復元できるんですね。

助かります。

本当にありがとうございました。

お礼日時:2016/05/31 07:09

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!