Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Since a couple of weeks I am using LINUX SuSE 9.0 . Its more than lovely.
Also it can be said of this great forum. It is very very very good. It already helped me a lot finding solutions.
But now I am having a major problem:
I managed to make a FAT32 partition where i've placed my htdos. I also managed to give my FAT32 partition read and write permissions by using the following into my fstab:
/dev/hda7 /windows/win_G vfat defaults,rw,gid=users,uid=dude 0 0
And the write permission works on all files and directories
BUT
My PHP script which should write txt - files gives an error : failed to open stream: Permission denied
So my php script suddenly won't work anymore, and it worked before when I was using windows. I know for sure that the PHP - script is correct. I hope its correct
So I don't know why my PHP script doesn't have write permission !!
I can write the same text - file by using an text-editor like KATE.
You give permissions to user "dude" of group "users" to access your partition, right? (You've set that in your fstab)
Well, if you write to your partition as user "dude" => no problems.
But now, you want to write to the partition from a PHP script. PHP scripts are called by your webserver, it might be Apache in your case. Apache is normally run by user "nobody", group "nobody".
If user nobody tries to write to your FAT partition, it will encounter an error, because only user "dude" has permissions. Either you can set "chmod 666" to your directory, where nobody has to write to. But that let's all other users write in there, what you might not want.
Best way may be to change your fstab.
Like you mentioned:
I have put user dude of group users in my fstab.
And true I can write as user dude.
But not my PHP - script
I thought it had something to do with Apache using user "nobody".
So
I have two solutions:
either "chmod 666" my directory . Do i do this by the command - konsole ? for example:
chmod 666 txt/ cause all files in this directory may be written by any user (no problem).
The other solutions is the Fstab.
So how do I put user "nobody" in the fstab with also write permissions ?
And is it possible to specify it only on several directories ?
my fstab looks like this right now:
/dev/hda7 /windows/win_G vfat defaults,rw,gid=users,uid=dude 0 0
so gid is group
uid is user
but what and how do i put other users in there ? In that case users nobody for apache ?
defaults is the same as the options " rw, suid, dev, exec, auto, nouser and async". So you don't need to specify rw explicitly.
I think you can't add several users to the fstab file. But you could make a new group, put it in your fstab, and then put nobody and dude in the newly created group. Afterwards you can edit the permissions of the group. That should work on a normal filesystem
However fat doesn't support unix permissions, and I can't get a clue out of it, if permissions are used and how they work there :-S
You can add "umask=000" after "uid=dude", and you will have set permissions of 777 to all files on your fat harddisk, and "nobody" should be able to write on it. However now _all_ users can write and read, and execute files. I haven't found other solutions yet
Using a DOS filesystem in a case like this is a big mistake because, as you see, all of the files in the while filesystem take the same permissions. Is there a reason you have to have this partition as DOS?
If you really, really need to do this, you could write a simple program, about 10 lines of Perl, that simply read a filename from stdin and then wrote everything else it read to that filename. You could write a daemon (it could be a shell script even) that ran as dude, user and which ran under xinetd, listening to a particular socket on localhost only, and then you could have it run under a socket and whenever you needed to output, you just open a connection to the socket, sent a line with the name of the file you want to create or append to, and then write your data.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.