Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Yury V. Zaytsev

On Tue, 20 Dec 2016, Joerg Thuemmler wrote:


seems to me that's normal a user usually should not be allowed to chown 
or chmod a /dev/pts/... but I don't have a clue, why that's working on 
other people's machines.


Well, then it seems that your system is even more botched than I 
suggested, surely the user *should* be able to control the permissions of 
the slave pseudoterminal device of the master device he's just requested.


The problem must be happening here:

https://github.com/MidnightCommander/mc/blob/master/src/subshell/common.c#L654

Rob is right that trying to get more help via the distribution support 
channels is the most promising course of action.


--
Sincerely yours,
Yury V. Zaytsev
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread /dev/rob0
On Tue, Dec 20, 2016 at 01:13:58PM +0100, Joerg Thuemmler wrote:
> chown("/dev/pts/1", 26, 5)  = -1 EPERM (Operation not permitted)

26 is a strange UID to use.  Most Linux distros allocating new user 
UIDs start at 500 or 1000.  Is the result different when using an 
account created by useradd/adduser [whichever is appropriate for your 
distro]?  Is Apparmor or SELinux in use?

> close(4)= 0
> write(2, "Cannot open master side of pty: "..., 69) = 69
> write(1, "\33[?1001s\33[?1002h\33[?1006h", 24) = 24
> write(1, "\33[?2004h", 8)   = 8
> 
> the last lines on root's side
> =
snip
> chown("/dev/pts/1", 0, 5)   = 0
> chmod("/dev/pts/1", 0620)   = 0
> ioctl(4, TIOCSPTLCK, [0])   = 0
> ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
> {B38400 opost isig icanon echo ...}) = 0
> ioctl(4, TIOCGPTN, [1]) = 0
> stat("/dev/pts/1", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
> open("/dev/pts/1", O_RDWR)  = 5
> 
> seems to me that's normal a user usually should not be allowed to 
> chown or chmod a /dev/pts/... but I don't have a clue, why that's 
> working on other people's machines.

I can't explain the magic of the Linux /dev/pts system, but yours is 
broken, so indeed this is probably better handled in a SuSE forum.

Looking in my own /dev/pts on my laptop, I own all the ptys.  On the 
multiuser system from which I send this mail, I see ptys owned by 
various active users.

The chown should have succeeded, because you would have already owned 
the pty.  The pty should have been created for you.  Which brings to 
mind another possibility of YDIW; are you trying to reallocate a pty 
which was already created by/for the root user?

Another thing to try, a long shot perhaps: leave root's mc running 
and using that /dev/pts/1, try the user's mc in a different terminal.
You should get something X > 1 for the /dev/pts/$X pty.
-- 
  http://rob0.nodns4.us/
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Joerg Thuemmler

Am 20.12.2016 um 11:45 schrieb Yury V. Zaytsev:

On Tue, 20 Dec 2016, Joerg Thuemmler wrote:


thx. Do you know, how mc detects the shell?


https://github.com/MidnightCommander/mc/blob/0cc22928afbc6e23eb0fa5c85fd95518d8151edc/lib/shell.c



It's in both cases (root and user) classical login with bash, never
manipulated there anything...


I seriously doubt it, because otherwise it would have worked out of the
box. A good test is to create a brand new fresh user, log in as this new
user and start mc. If it works, then it means that you've botched your
user profile. If it doesn't work, maybe you've botched system profile.



Hi,

don't think it's kind of this. No change for a brand new user.
I strace'd the mc running under root and user. Found a classic rights 
problem:


at users side:
===
statfs("/dev/pts", {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, 
f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0},
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
{B38400 opost isig icanon echo ...}) = 0

ioctl(4, TIOCGPTN, [1]) = 0
stat("/dev/pts/1", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 1), ...}) = 0
getuid()= 26
socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5
connect(5, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = 
-1 ENOENT (No such file or directory)

close(5)= 0
socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5
connect(5, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = 
-1 ENOENT (No such file or directory)

close(5)= 0
open("/etc/group", O_RDONLY|O_CLOEXEC)  = 5
lseek(5, 0, SEEK_CUR)   = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=669, ...}) = 0
mmap(NULL, 669, PROT_READ, MAP_SHARED, 5, 0) = 0x7f8a243b1000
lseek(5, 669, SEEK_SET) = 669
munmap(0x7f8a243b1000, 669) = 0
close(5)
chown("/dev/pts/1", 26, 5)  = -1 EPERM (Operation not permitted)
close(4)= 0
write(2, "Cannot open master side of pty: "..., 69) = 69
write(1, "\33[?1001s\33[?1002h\33[?1006h", 24) = 24
write(1, "\33[?2004h", 8)   = 8

the last lines on root's side
=
open("/etc/group", O_RDONLY|O_CLOEXEC)  = 5
lseek(5, 0, SEEK_CUR)   = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=669, ...}) = 0
mmap(NULL, 669, PROT_READ, MAP_SHARED, 5, 0) = 0x7facc5f95000
lseek(5, 669, SEEK_SET) = 669
munmap(0x7facc5f95000, 669) = 0
close(5)= 0
chown("/dev/pts/1", 0, 5)   = 0
chmod("/dev/pts/1", 0620)   = 0
ioctl(4, TIOCSPTLCK, [0])   = 0
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
{B38400 opost isig icanon echo ...}) = 0

ioctl(4, TIOCGPTN, [1]) = 0
stat("/dev/pts/1", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
open("/dev/pts/1", O_RDWR)  = 5

seems to me that's normal a user usually should not be allowed to chown 
or chmod a /dev/pts/... but I don't have a clue, why that's working on 
other people's machines.


Redirecting stderr to a file shows exactly the EPERM thats in the strace 
lines of user.


--
www.teddylinx.de
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Yury V. Zaytsev

On Tue, 20 Dec 2016, Joerg Thuemmler wrote:


thx. Do you know, how mc detects the shell?


https://github.com/MidnightCommander/mc/blob/0cc22928afbc6e23eb0fa5c85fd95518d8151edc/lib/shell.c

It's in both cases (root and user) classical login with bash, never 
manipulated there anything...


I seriously doubt it, because otherwise it would have worked out of the 
box. A good test is to create a brand new fresh user, log in as this new 
user and start mc. If it works, then it means that you've botched your 
user profile. If it doesn't work, maybe you've botched system profile.


--
Sincerely yours,
Yury V. Zaytsev
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Joerg Thuemmler

Am 20.12.2016 um 09:35 schrieb Yury V. Zaytsev:

On Tue, 20 Dec 2016, Joerg Thuemmler wrote:


Maybe it's a stupid, well known thing, but if I'm using a newer
version of mc (e.g. 4.8.13) and I'm not root, I have no subshell, C-o
works, but immediately vanishes if I press a key. Same thing with mc
-U. If I'm root, subshell works, setting /usr/bin/mc setuid works too,
but is not wanted... Is there a user group I have to be in or some
other user rights limitation I have to change?


Apparently the shell you have as a user is not detected properly.



Hi,

thx. Do you know, how mc detects the shell? It's in both cases (root and 
user) classical login with bash, never manipulated there anything...


cu jth
--
www.teddylinx.de
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Felix Miata

Joerg Thuemmler composed on 2016-12-20 08:19 (UTC+0100):
...

I use Opensuse linuxes, but seems to me, it isn't related to this.


How old is your openSUSE?


Another thing is that mc start is delayed, if no internet connection
exists, seems it's looking for something, maybe updates... no clue, why
and don't know since which version this is the behavior.


https://bugzilla.opensuse.org/show_bug.cgi?id=824729 may be what you see 
(hostname related). IIRC, you can avoid the delay by making sure /etc/hosts 
properly contains your hostname.


I'm pretty sure you can use a newer mc version from a supported openSUSE release 
without any issues, except for latest, 4.8.18, which is broken.

--
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Yury V. Zaytsev

On Tue, 20 Dec 2016, Joerg Thuemmler wrote:

Maybe it's a stupid, well known thing, but if I'm using a newer version 
of mc (e.g. 4.8.13) and I'm not root, I have no subshell, C-o works, but 
immediately vanishes if I press a key. Same thing with mc -U. If I'm 
root, subshell works, setting /usr/bin/mc setuid works too, but is not 
wanted... Is there a user group I have to be in or some other user 
rights limitation I have to change?


Apparently the shell you have as a user is not detected properly.

--
Sincerely yours,
Yury V. Zaytsev
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: No subshell ifnot root, delayed start with no internet connection

2016-12-20 Thread Yury V. Zaytsev

On Tue, 20 Dec 2016, Joerg Thuemmler wrote:

Another thing is that mc start is delayed, if no internet connection exists, 
seems it's looking for something, maybe updates... no clue, why and don't 
know since which version this is the behavior.


That must be Samba, try re-compiling without it if you don't need it, or 
else fix your system such that DNS resolution will work irrespectively of 
whether you've got an Internet connection or not.


--
Sincerely yours,
Yury V. Zaytsev
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc