cancel
Showing results for 
Search instead for 
Did you mean: 

mesg: cannot change mode

 
itrc55
Regular Advisor

mesg: cannot change mode

Hi,

 

i facing strange issue with all users on multiple servers, where when i switch from root user to any other user as following

 

# su - testuser

 

i facing the below message

 

mesg: cannot change mode
mesg: cannot change mode

 

please your support.

 

Thanks

 

2 REPLIES
itrc55
Regular Advisor

Re: mesg: cannot change mode

Hi,

and also when i login direct or by switch from root user to any normal user i don't see any thing under the home directory
but when i run more command as following

$ more .profile

i see the content of this file ????! although there is nothing

$ ls -l
total 0


$ pwd
/home/mousa
$
$
$
$ cd
$ ll
total 0
$ pwd
/home/mousa
$
$
$
$ more .profile

# @(#)B.11.31_LR

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# NOTE: '.' is added to $PATH for compatibility reasons only. This
# default will be changed in a future release. If "." is not
# needed for compatibility it is better to omit this line.
# Please edit .profile according to your site requirements.

# Set up the search paths:
PATH=$PATH:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR
umask 077
mesg n

Thanks
Matti_Kurkela
Honored Contributor

Re: mesg: cannot change mode

In Unix, files with "." as the first character of the filename are normally hidden. You can see them when you add option "-a" to the ls command.

 

In HP-UX, the "-a" option for ls is on by default for root, but off for all other users. So root will see all files with just "ls -l", but other users will need "ls -la".

 

When you login, you are given the ownership to the TTY/PTY device of your session. You can know your tty device with the command "tty".

 

The "mesg" command tries to change the permissions of the TTY/PTY device: "mesg n" is equivalent to "chmod o-w $(tty)", and "mesg y" is equivalent to "chmod o+w $(tty)".

 

When you use "su" or similar to switch to another user, the TTY/PTY device stays owned by the original user. When you switch from regular user to root, this is not a problem because root can change anything anyway. But when you switch from root to regular user, or from one regular user to another, commands like "mesg" may cause errors. This is usually nothing more than a minor inconvenience.

MK