<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>11127</bug_id>
          
          <creation_ts>2017-03-06 13:22:26 +0000</creation_ts>
          <short_desc>mesg does not work after su --login</short_desc>
          <delta_ts>2017-08-01 09:38:54 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>Backport to 2.3.1</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.4 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Ohly">patrick.ohly</reporter>
          <assigned_to name="Patrick Ohly">patrick.ohly</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>71085</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-03-06 13:22:26 +0000</bug_when>
    <thetext>To reproduce, build current core-image-minimal for Poky with default config. Boot into qemu, then:

root@qemux86:~# adduser test
Changing password for test
New password: 
Retype password: 
Password for test changed by root
root@qemux86:~# su - test
qemux86:~$ mesg n
qemux86:~$ mesg y
mesg: error: tty device is not owned by group `tty&apos;

qemux86:~$ cat ~/.profile 
# ~/.profile: executed by Bourne-compatible login shells.

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

# path set by /etc/profile
# export PATH

mesg n

Note that &quot;mesg n&quot; is run by default and just happens to work accidentally (?).

qemux86:~$ ls -l /proc/self/fd/2 
lrwx------    1 test     test            64 Mar  6 13:07 /proc/self/fd/2 -&gt; /dev/ttyS0
qemux86:~$ ls -l /dev/ttyS0
crw-------    1 root     root        4,  64 Mar  6 13:07 /dev/ttyS0
qemux86:~$ ls -l /usr/bin/mesg
/usr/bin/mesg -&gt; /usr/bin/mesg.sysvinit

It fails slightly differently with systemd + pam (not tested without pam):

DISTRO_FEATURES_append = &quot; pam systemd&quot;
VIRTUAL-RUNTIME_init_manager = &quot;systemd&quot;
VIRTUAL-RUNTIME_initscripts = &quot;&quot;
DISTRO_FEATURES_BACKFILL_CONSIDERED = &quot;sysvinit&quot;

qemux86 login: root
root@qemux86:~# adduser test
New password: 
Retype new password: 
passwd: password updated successfully
root@qemux86:~# su - test
mesg: Operation not permitted
qemux86:~$ mesg n
mesg: Operation not permitted
qemux86:~$ mesg y
mesg: Operation not permitted
root@qemux86:~# ls -l /usr/bin/mesg 
lrwxrwxrwx    1 root     root            19 Mar  6 13:11 /usr/bin/mesg -&gt; /bin/busybox.nosuid

Here &quot;mesg&quot; always fails and prints the error message.

That the /dev/tty* permissions prevent using mesg after &quot;su --login&quot; is probably unavoidable. It does not happen when logging into the console as the user directly.

However, the error message is annoying. Perhaps the default .profile should use &quot;mesg n 2&gt;/dev/null&quot; ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73738</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-06-06 11:27:08 +0000</bug_when>
    <thetext>Patrick, would you be able to handle this?  Your resolution seems sensible to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75549</commentid>
    <comment_count>2</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-08-01 09:38:54 +0000</bug_when>
    <thetext>Fixed in &quot;base-files: ignore &quot;mesg n&quot; error messages&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>