?
Solved

Permission denied

Posted on 2000-03-28
8
Medium Priority
?
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2666008
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
ID: 2666098
it gotta be something relate to tty because currently every user have mesg on, can talk, can write ...
0
 

Expert Comment

by:markparr
ID: 2667138
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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:ahTri
ID: 2667491
I did try but onn SUN /dev/pts/# is just a link to ../devices/pseudo/..... so cannot change access right
0
 
LVL 2

Accepted Solution

by:
festive earned 150 total points
ID: 2667657
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
ID: 2667728
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
ID: 2668051
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
ID: 2668440
this script to run needs to be setuid root, and the top line means that it is a bourne shell script.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 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