简体   繁体   中英

What could be the causes of “permission denied” for tty1?

On my VPS server (Fedora 9), mingetty keeps respawning itself because of a "permission denied" error on tty[1-6], even though:

root# ls -la /dev/tty1
crw------- 1 root root 4, 1 Sep 19 14:22 /dev/tty1

Even weirder, this doesn't work:

root# cat </dev/tty1
bash: /dev/tty1: Permission denied

I am guessing this has something to do with the VM host, but both my VPS provider and I are out of ideas, and so is Google... Any clue as to why root cannot access a character device with root rw privileges?

Update: I've made sure SELinux has been disabled; yet, the issue is still there....

Update: The strace dump:

32399 rt_sigaction(SIGTSTP, {SIG_DFL}, {SIG_DFL}, 8) = 0
32399 rt_sigaction(SIGTTIN, {SIG_DFL}, {SIG_IGN}, 8) = 0
32399 rt_sigaction(SIGTTOU, {SIG_DFL}, {SIG_IGN}, 8) = 0
32399 rt_sigaction(SIGINT, {SIG_IGN}, {SIG_IGN}, 8) = 0
32399 rt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_IGN}, 8) = 0
32399 rt_sigaction(SIGCHLD, {SIG_DFL}, {0x807b990, [], SA_RESTORER, 0xb7e7b708}, 8) = 0
32399 open("/dev/tty1", O_RDONLY|O_LARGEFILE) = -1 EACCES (Permission denied)
32399 open("/dev/tty1", O_RDONLY|O_LARGEFILE) = -1 EACCES (Permission denied)
32399 fstat64(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
32399 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe1000
32399 write(2, "bash: /dev/tty1: Permission deni"..., 35) = 35

Can't say it's making much sense to me...

I dont have an exact answer, but I have a suggestion.

Use ltrace and strace to get an impression of what is used "under the hood" like this:

strace -f -o LOG bash -c 'cat < /dev/tty1'

(same args for "ltrace"). Examine LOG to find out which syscall triggers the "permission denied". Maybe it will give you one more keyword to feed to google or useful snippet of log to add to your question here.

I suspect that SELinux may be the problem. Try temporarily disabling it to see if it works.

i'm not sure if this will help you, but have to check first.... i found that - in many cases the system administrator disabled access to such stuff so try to look for this file : /etc/security/access.conf, and find the line "#-:ALL EXCEPT root:tty1".This line if active ( mean no # in first ) will disallow non-root logins on tty1 But be care DON'T CHNAGE - better to check with your system admin.

hope this help

Go into your /etc/inittab and comment out the following lines (or others like it). You may need to reboot to stop the re-spawns

c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM