LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-03-2010, 06:14 PM   #1
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Rep: Reputation: 87
Question When can access("blah", R_OK) succeed and open("blah", O_RDONLY) fail?


Here are two sequential lines of an strace of evince.
access("/home/me/.Xauthority", R_OK) = 0
open("/home/me/.Xauthority", O_RDONLY) = -1 EACCES (Permission denied)

Very strangely the corresponding snippet of any other X program I run has...
access("/home/me/.Xauthority", R_OK) = 0
open("/home/me/.Xauthority", O_RDONLY) = 4

Reading The Fine Man pages I cannot understand how access() can succeed and open() fail.
 
Old 08-03-2010, 06:33 PM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
The interpretation of the *_OK modes can be affected by what sort of User, and the kernel version. Also if the file system is NFS
mounted, NFS can have it's own access mechanisms.

So we could use some additional info. to try to help you.

Does the User "me" or whatever User is using the home directory "/home/me", have root privileges?
Is the kernel version newer than version 2.6.3?
Is "/home/me" on an NFS mounted file system?
 
Old 08-03-2010, 08:53 PM   #3
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Original Poster
Rep: Reputation: 87
Both programs are run as user "me", and the file is owned by me, and has permissions -rw------- and the file system is ext4 on a Lucid Ubuntu system.
 
Old 08-03-2010, 09:01 PM   #4
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Original Poster
Rep: Reputation: 87
Meh! I have found it.

apparmor is to blame.

I had moved my home directory off the smaller solid state root disk to a 500gb harddrive and mounted at it via a symlink.

ie. My home dir is really /disk_1/home/me and I have a symnik /home/me -> /disk_1/home/me

The solution is to run
sudo dpkg-reconfigure apparmor
 
  


Reply

Tags
apparmor, evince, lucid



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
Hardy won't startup, stops with a "fail" and I have to "ctrl+alt+del" to boot. brjoon1021 Ubuntu 10 12-15-2008 06:29 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
C++ system("blah"); enragedchip Programming 1 05-27-2004 03:19 PM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-29-2004 11:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration