LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 11-12-2005, 07:24 AM   #1
mark78301
LQ Newbie
 
Registered: Nov 2005
Posts: 2

Rep: Reputation: 0
Question ssh login with normal user, receive: /dev/null: Permission denied


Hello All,

I have a dedicated server which was formerly running FreeBSD, but was recently replaced with RedHat 9 (Shrike) after a catastrophic hard drive failure. My ISP that hosts the box is pretty crappy, and would love to charge me about $100/hr to fix this problem, but it should be an easy fix with some guidance.

Anyway, this is a fresh install and I have been the only one on the box so far. The problem is when I SSH in with a normal user account, this is what I am presented with:

mark@'s password:
-bash: /dev/null: Permission denied
-bash: /dev/null: Permission denied
-bash: /dev/null: Permission denied
-bash: /dev/null: Permission denied
-bash: /dev/null: Permission denied
-bash: /dev/null: Permission denied
[mark@]$

Also, after I view a file with 'less' I see:

[mark@]$ less test
/usr/bin/lesspipe.sh: line 50: /dev/null: Permission denied
[mark@]$

When I log in with root, I don't get any of the /dev/null errors. Here is /dev/null:

crw-r--r-- 1 root root 1, 3 Nov 11 18:46 /dev/null

I just can't figure this one out. If anyone could offer a suggestion, it would be greatly appreciated.

Thank you in advance,

Mark
 
Old 11-12-2005, 08:19 AM   #2
julz_51
Member
 
Registered: Mar 2005
Location: France
Distribution: Gentoo, Debian, FC4
Posts: 40

Rep: Reputation: 15
Set permissions 666 on /dev/null. Non-root users lack writing permissions.
 
Old 11-12-2005, 08:32 AM   #3
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,950
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
The basic answer is you don't have permissions to write to /dev/null

Not trying to be facetious - just that the message is telling you the problem.

As root simply type "chmod 666 /dev/null". A subsequent "ls -l /dev/null" should show it now has "crw-rw-rw-" in the left most column. (For more details on the chmod command type "man chmod".)

DETAILED RESPONSE FOLLOWS:

Quote:
crw-r--r-- 1 root root 1, 3 Nov 11 18:46 /dev/null
The left column of this entry is telling you it is a c(haracter) device that has r(ead) and w(rite) for the owner but only r(ead) for group and r(ead) for all other users. the "root root" later in line tells you the owner is called root and the group is also called root. (Despite same name owner and group are two different things - owners in /etc/passwd and groups in /etc/group.) Anyway since owner is root and its writable ONLY by owner it means only root can write to it. Since /dev/null is a bit bucket there's no reason to restrict it that way. It should be writable by all.

Of course what's got me wondering is why the hell its trying to access /dev/null in the first place. Maybe it always has and I just didn't realize it. Typically /dev/null is where you redirect unwanted output so it doesn't appear on your screen or in a log file. For example typing:
'ls -l >/dev/null" would send output to /dev/null so you'd never see it on the screen. Its common in background scripts such as init scripts or cron to redirect unwanted output as follows:
myscript.sh >/dev/null 2>&1

The above says to send standard output (stdout a/k/a file descriptor 1) to /dev/null instead of the default (normally the terminal) then says to redirect standard error (stderr a/k/a file descriptor 2) to file descriptor 1 which has been redefined as /dev/null earlier on the line.

P.S. RedHat 9 is rather old. Unless you have a specific need for it you might want to install the latest RedHat non-commercial Linux which is Fedora Core 4 (or at least Fedora Core 3 - the 2.6 kernel in 4 is still giving folks some issues but Fedora Core 3 is a lot later.) RedHat has split their commercial and non-commercial so that RedHat branded stuff (RedHat EL/AS) is commercial and Fedora is non-commercial

Last edited by MensaWater; 11-12-2005 at 08:36 AM.
 
Old 11-12-2005, 09:20 AM   #4
mark78301
LQ Newbie
 
Registered: Nov 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Problem Solved -- Thanks!

julz_51 and jlightner,

Thank you very much for your replies. Changed the permissions like suggested and it's fixed.

-Mark
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submount, "permission denied" when writing to floppy as normal user DaneM Linux - Software 5 02-22-2006 02:05 PM
/dev/null: Permission denied phoenix7 Linux - Distributions 1 10-01-2005 06:31 PM
slackware /dev/null permission denied reddazz Slackware 8 03-09-2005 07:56 PM
Konsole = /dev/null: permission denied????? ithawtewrong Linux - Newbie 3 09-23-2004 05:39 PM
/dev/null: Permission denied LavaDevil94 Linux - Software 2 09-14-2004 11:44 PM


All times are GMT -5. The time now is 06:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration