Solved

Permission denied

Posted on 2000-03-28
8
342 Views
Last Modified: 2013-12-27
I'm using a SUN server and while using

echo "Yoh" > /dev/pts/x (x is a number)

I can send the message to myself, or when I'm root, I can send mesg to user but user cannot send message to each other, error message is "permission denied", what can I do with this ?
0
Comment
Question by:ahTri
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 40

Expert Comment

by:jlevie
Comment Utility
Well you're not supposed to be able to do that as an ordinary user. If you could write to just any user's terminal a lot of malicious things would be possible and there wouldn't be any way for the user to control it. Don't do it that way.

There are facilities within Unix specifically for this purpose. Look at the man pages for wall(1M), write(1), mesg(1), and talk(1). Probably the one you want is write(1).
0
 

Author Comment

by:ahTri
Comment Utility
it gotta be something relate to tty because currently every user have mesg on, can talk, can write ...
0
 

Expert Comment

by:markparr
Comment Utility
Have you checked the permissions on the /dev/pts/#?  I just checked my nonsecure development machine (IBM RS/6000) and the permissions are set to rw--w--w- so everyone has write access to my tty so a "echo message > /dev/pts/#" would work.
0
 

Author Comment

by:ahTri
Comment Utility
I did try but onn SUN /dev/pts/# is just a link to ../devices/pseudo/..... so cannot change access right
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Accepted Solution

by:
festive earned 50 total points
Comment Utility
As stated already by jlevie this is not something that you would normally do,
however if you must do it you need to setup a shell script or program as "setuid" root.
you could then redirect the output to the target pty, ie something like the following:

#!/bin/sh -p
PROGRAM=$0
ARG1="$1" # pty number
ARG2="$2" message in quotes
cat $ARG2 > $ARG1

This is not recommended, and perhaps a compromise may be to put setuid on one of the mentioned utilities.

0
 
LVL 40

Expert Comment

by:jlevie
Comment Utility
I don't think you need suid on write(1) and I know that you don't on talk(1).
0
 

Author Comment

by:ahTri
Comment Utility
festive, is that a script to run on root ?

#!/bin/sh -p

this line doesn't run, maybe I don't have sh
0
 
LVL 2

Expert Comment

by:festive
Comment Utility
this script to run needs to be setuid root, and the top line means that it is a bourne shell script.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now