LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-03-2009, 10:38 AM   #1
gmartin
Member
 
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Rep: Reputation: 40
Shot myself in the foot


OK, I made a mistake that is killing me. Long story, but I reset the permissions on /var/run to to be owned by root, group users with group having read/write as well. I then copied that down to the subfolders and stuff stopped working (most notably apache couldn't access mysql through the socket in /var/run/mysql).

Is there anyway to recover these permissions. Or in knowing how they should be set?

(FWIW, I have backups but not of the entire /var tree)
(FWIW2 - this is my home system and of not huge importance)


Thanks
 
Old 01-03-2009, 10:47 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,511

Rep: Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884
/var/run
drwxr-xr-x 35 0 0 4096 2009-01-03 16:49 run

The sub directorys have
drwxr-xr-x 2 0 0 4096 2008-07-29 16:33 sshd
 
Old 01-03-2009, 10:48 AM   #3
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,315

Rep: Reputation: Disabled
You may get help from the script Alan Hicks posted on a.o.l.s. some years ago. The script uses Slackware's "slackware/MANIFEST.bz2" file to generate a load of commands that reset the permissions back to the original state of every file/directory installed by Slackware.
You can capture these commandlines (they are written to the standard output of the script) and remove everything you don't need (only the commands that change permissions and owndership below /var are relevant to you).

You can find the posting of that script here: http://groups.google.nl/group/alt.os...1872abfdf2c110

Eric
 
Old 01-03-2009, 10:53 AM   #4
GazL
Senior Member
 
Registered: May 2008
Posts: 3,447

Rep: Reputation: 975Reputation: 975Reputation: 975Reputation: 975Reputation: 975Reputation: 975Reputation: 975Reputation: 975
These are mine if they help

directories:
Code:
root@jupiter:~# find /var/run -type d -exec ls -ld {} \;
drwxr-xr-x 14 root root 4096 2009-01-03 13:27 /var/run
drwxr-xr-x 3 root lp 48 2008-12-05 13:52 /var/run/cups
dr-x--x--x 2 lp sys 1 2008-12-05 13:52 /var/run/cups/certs
drwxr-xr-x 2 root root 16 2009-01-03 13:27 /var/run/dbus
drwxr-xr-x 4 haldaemon haldaemon 16 2008-12-08 01:14 /var/run/hald
drwxr-xr-x 2 root root 1 2008-12-08 01:14 /var/run/hald/hald-local
drwxr-xr-x 2 root root 1 2008-12-08 01:14 /var/run/hald/hald-runner
drwxr-xr-x 2 root root 1 2008-10-22 23:55 /var/run/httpd
drwxr-xr-x 2 root root 1 2008-02-27 03:40 /var/run/iptraf
drwxr-xr-x 2 mpdserv mpdserv 8 2009-01-03 13:27 /var/run/mpd
drwxr-xr-x 2 mysql mysql 1 2008-10-05 06:29 /var/run/mysql
drwxr-xr-x 2 root root 1 2008-09-17 07:35 /var/run/named
drwxr-xr-x 2 root root 1 2008-11-21 07:09 /var/run/nscd
drwxr-xr-x 2 root root 1 2008-11-14 23:45 /var/run/proftpd
drwxr-xr-x 2 root root 1 2006-09-12 08:33 /var/run/stunnel
drwx------ 2 root root 1 2008-12-12 16:04 /var/run/sudo
files:
Code:
root@jupiter:~# find /var/run -type f -exec ls -ld {} \;
-rw-r--r-- 1 root root 5 2009-01-03 13:27 /var/run/acpid.pid
-rw-r--r-- 1 root root 5 2009-01-03 13:27 /var/run/atd.pid
-rw-r--r-- 1 root root 5 2009-01-03 13:27 /var/run/dbus/dbus.pid
-rw-r--r-- 1 root root 5 2009-01-03 13:27 /var/run/gpm.pid
-rw-r--r-- 1 root root 5 2009-01-03 13:27 /var/run/klogd.pid
-rw-r--r-- 1 mpdserv mpdserv 5 2009-01-03 13:27 /var/run/mpd/mpd.pid
-rw-r--r-- 1 root root 4 2009-01-03 13:27 /var/run/ntpd.pid
-rw-r--r-- 1 root root 5 2009-01-03 13:27 /var/run/syslogd.pid
-rw-rw-r-- 1 root utmp 4608 2009-01-03 13:33 /var/run/utmp
 
Old 01-03-2009, 11:20 AM   #5
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,477

Rep: Reputation: Disabled
Quote:
Originally Posted by gmartin View Post
(most notably apache couldn't access mysql through the socket in /var/run/mysql).
/var/run/mysql should be owned by mysql:mysql. Apache doesn't access this directly, but communicates with the mysqld (daemon) process which does.

Brian
 
Old 01-03-2009, 12:06 PM   #6
gmartin
Member
 
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Original Poster
Rep: Reputation: 40
Eric, I'm trying a hybrid approach. I'm reviewing the contents of MANIFEST And setting the perms by hand. I can always go back and cleanup MANIFEST and run the script. Thanks

Brian, when I set /var/run/mysql to mysql:mysql I get this error from a web app
Code:
Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
Granting apache access to the directory resolves the problem. Any ideas?
 
Old 01-03-2009, 12:25 PM   #7
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,477

Rep: Reputation: Disabled
what does "ls -l /var/run/mysql" show?

Brian
 
Old 01-03-2009, 02:23 PM   #8
gmartin
Member
 
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by BCarey View Post
what does "ls -l /var/run/mysql" show?

Brian
Code:
root@USlack2:/etc/cron.weekly# ls -l /var/run/mysql
total 4
-rw-rw-r-- 1 mysql mysql 5 2009-01-01 01:24 mysql.pid
srwxrwxr-x 1 mysql mysql 0 2009-01-01 01:24 mysql.sock=
If I add the apache user to the mysql group, everything works.
Note: this is a php app if it matters.
 
Old 01-03-2009, 02:53 PM   #9
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,477

Rep: Reputation: Disabled
Is that = sign at the end of mysql.sock a typo?

"chmod o+w /var/run/mysql.sock" should take care of it.

Brian
 
Old 01-03-2009, 03:12 PM   #10
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,023

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Following GazL's lead, here are mine (Slackware 12.1, basic install):
Code:
root@FamilyRoom:/# find /var/run -type d -exec ls -ld {} \;
drwxr-xr-x 13 root root 1024 2009-01-01 09:02 /var/run
drwxr-xr-x 2 mysql mysql 1024 2008-04-28 15:54 /var/run/mysql
drwxr-xr-x 3 root lp 1024 2009-01-01 09:02 /var/run/cups
dr-x--x--x 2 lp sys 1024 2009-01-01 09:02 /var/run/cups/certs
drwxr-xr-x 2 root root 1024 2006-09-12 01:33 /var/run/stunnel
drwxr-xr-x 2 root root 1024 2008-04-19 23:41 /var/run/nscd
drwxr-xr-x 2 root root 1024 2009-01-01 09:02 /var/run/httpd
drwx------ 2 root root 1024 2008-10-02 15:48 /var/run/sudo
drwxr-xr-x 2 root root 1024 2008-02-26 20:40 /var/run/iptraf
drwxr-xr-x 2 root root 1024 2007-12-10 12:04 /var/run/proftpd
drwxr-xr-x 2 root root 1024 2009-01-01 09:02 /var/run/dbus
drwxr-xr-x 4 haldaemon haldaemon 1024 2008-04-01 16:06 /var/run/hald
drwxr-xr-x 2 root root 1024 2008-04-01 16:06 /var/run/hald/hald-runner
drwxr-xr-x 2 root root 1024 2008-04-01 16:06 /var/run/hald/hald-local
drwxr-xr-x 2 root root 1024 2008-04-13 16:07 /var/run/named
root@FamilyRoom:/# find /var/run -type f -exec ls -ld {} \;
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/gpm.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/sshd.pid
-r--r----- 1 root sys 32 2009-01-01 09:02 /var/run/cups/certs/0
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/hald.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/atd.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/syslogd.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/httpd/httpd.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/inetd.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/klogd.pid
-rw-r--r-- 1 root root 5 2009-01-01 09:02 /var/run/dbus/dbus.pid
-rw-rw-r-- 1 root utmp 4992 2009-01-03 12:06 /var/run/utmp
root@FamilyRoom:/#
 
Old 01-03-2009, 04:33 PM   #11
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,315

Rep: Reputation: Disabled
Quote:
Originally Posted by BCarey View Post
Is that = sign at the end of mysql.sock a typo?
The mysql.sock is a socket file, the '=' is how that fact is shown to the user, like an executable file is distinguished by the '*' at the end.

Eric
 
Old 01-03-2009, 04:42 PM   #12
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,477

Rep: Reputation: Disabled
Quote:
Originally Posted by Alien Bob View Post
The mysql.sock is a socket file, the '=' is how that fact is shown to the user, like an executable file is distinguished by the '*' at the end.

Eric
Interesting. Why wouldn't it show up when I do ls -l?

Brian
 
Old 01-03-2009, 05:45 PM   #13
gmartin
Member
 
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Original Poster
Rep: Reputation: 40
Solved

Quote:
Originally Posted by BCarey View Post
Is that = sign at the end of mysql.sock a typo?

"chmod o+w /var/run/mysql.sock" should take care of it.

Brian
OK, indeed it did. Question is, what did it do?

Before:
Code:
root@USlack2:/var/run/mysql# ls -l
-rw-rw-r-- 1 mysql mysql 5 2009-01-01 01:24 mysql.pid
srwxrwxr-x 1 mysql mysql 0 2009-01-01 01:24 mysql.sock=

root@USlack2:/var/run/mysql# chmod o+w mysql.sock
After:
Code:
root@USlack2:/var/run/mysql# ls -l
total 4
-rw-rw-r-- 1 mysql mysql 5 2009-01-01 01:24 mysql.pid
srwxrwxrwx 1 mysql mysql 0 2009-01-01 01:24 mysql.sock=
Looking at the results it appears you gave world(others) write rights. I was confused by the 'o' As I was thinking owner. 'man chmod' set me straight.

One other thing. the "=" is not a typo. It shows in the console like that. What does that mean?
 
Old 01-03-2009, 05:47 PM   #14
gmartin
Member
 
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by haertig View Post
Following GazL's lead, here are mine (Slackware 12.1, basic install):
Thanks. The more info the better.
 
Old 01-03-2009, 05:51 PM   #15
gmartin
Member
 
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Original Poster
Rep: Reputation: 40
I need to find a good tutorial on unix/linux rights. I know the basics, ok. But the sticky bit, uid & gid still trip me up. For instance, the "s" at the beginning of this line:
Code:
srwxrwxrwx 1 mysql mysql 0 2009-01-01 01:24 mysql.sock=
I assume that's sticky but I'm not sure what that means.
 
  


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
Foot fell asleep colinstu General 13 04-17-2006 03:52 PM
foot pedal for medical transcription ChinTimDude Suse/Novell 11 10-07-2005 10:38 PM
MicroSoft playing catchup on the back foot TigerOC General 5 06-09-2005 01:56 AM
Can ping to the internet but not to the computer 3 foot away. Why not? Tiyogi Red Hat 10 04-03-2004 05:34 AM
I put my foot down (A tribute to Tinkster) kadaver Slackware 4 11-20-2003 05:50 AM


All times are GMT -5. The time now is 07:34 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