LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-06-2004, 11:03 PM   #1
aroundtuit
LQ Newbie
 
Registered: Sep 2004
Location: Melbourne
Distribution: Gentoo
Posts: 6

Rep: Reputation: 0
Why can I not create a file?


I am inexperienced with Linux, but have some mostly forgotten Unix knowledge.


I do not know why the touch is causing the exception below -

peter@patlynch peter $ touch aa.txt

touch: cannot touch `aa.txt': Permission denied

peter@patlynch peter $ ls .. -al

total 19
drwxr-xr-x 10 root root 264 May 26 06:32 .
drwxr-xr-x 20 root root 632 Aug 31 01:07 ..
-rw-r--r-- 1 root root 0 Jul 9 2003 .keep
drwxrws--- 21 ftp ftp 2736 Aug 20 01:17 ftp
drwxr-xr-x 7 root root 184 Jan 23 2004 httpd
drwxr-xr-x 2 283 ftp 48 Mar 5 2004 ogg
drwxr-x--- 98 283 pat 7968 Aug 20 22:13 pat
drwxr-xr-x 19 500 peter 928 Sep 7 12:06 peter
drwxr-x--- 30 2000 siobhan 2720 Feb 24 2004 siobhan
drwx------ 2 1002 users 104 May 26 06:28 test
drwx------ 2 1003 users 104 May 26 06:32 test23

peter@patlynch peter $ cat /etc/passwd | grep peter

peter:x:2002:500::/home/peter:/bin/bash
peter@patlynch peter $ cat /etc/group | grep peter
wheel::10:root,pat,peter,siobhan
audio::18at,root,siobhan,peter
ftp::21eter,siobhan,pat,nick,laura,apache
games::35at,siobhan,peter
users::100:games,siobhan,pat,peter
peter::500:apache
apache:x:81at,peter

peter@patlynch peter $



I have tried to present as much information as I can - if you need more please ask.


Thanks for your attention.

Peter
 
Old 09-06-2004, 11:18 PM   #2
hkb33
Member
 
Registered: Sep 2004
Location: Raleigh NC
Distribution: Fedora / RHEL
Posts: 171

Rep: Reputation: 30
run the following command:

pwd

this shows where you currently are. You may be in a directory where you do not have permission to write.
 
Old 09-06-2004, 11:20 PM   #3
aroundtuit
LQ Newbie
 
Registered: Sep 2004
Location: Melbourne
Distribution: Gentoo
Posts: 6

Original Poster
Rep: Reputation: 0
pwd shows
/home/peter
 
Old 09-07-2004, 12:01 AM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
What does 'ls -ld .' (no quotes) show? Also 'ls -l aa.txt' (in case the file already exists).
 
Old 09-07-2004, 12:34 AM   #5
levian
LQ Newbie
 
Registered: Aug 2003
Location: kadin, jkt
Distribution: Dolphin,Shrike,98
Posts: 20

Rep: Reputation: 0
drwxr-xr-x 10 root root 264 May 26 06:32 .
Your home directory owned by root and you dont have write access in it.
 
Old 09-07-2004, 12:43 AM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by levian
drwxr-xr-x 10 root root 264 May 26 06:32 .
Your home directory owned by root and you dont have write access in it.
That's actually /home, not /home/peter ...
look at his ls-statement ...

Code:
ls .. -al
His problem is that he's obviously not user 500 :)
He's in group peter, but there's no user peter
despite the fact that his home exists.

As a matter of fact, there's no valid users
(judging by name) besides root and ftp.


Cheers,
Tink

Last edited by Tinkster; 09-07-2004 at 12:46 AM.
 
Old 09-07-2004, 02:12 AM   #7
aroundtuit
LQ Newbie
 
Registered: Sep 2004
Location: Melbourne
Distribution: Gentoo
Posts: 6

Original Poster
Rep: Reputation: 0
Thankyou for the help.

I am not user 500. I do not know what that really means.

Perhaps if I tell you how I got into this predicament where I need to look at Linux (which I am actually enjoying - it is amazing how stuff from the past comes back - just not enough).

My son installed Gentoo. He is away at the snow for the season. All my internet access is via Linux, and I use the apache server for publishing to the web. This was via a user he had set up for me - peter - with a password of (like) "abcdefgh" - no numbers in it when I logged in thru putty.

For an unknown reason, the user peter disappeared off the Linux machine. I really do not know how. I didn't do it consciously, and extremely unlikely inadvertently. (?)

So I went in as root and eventually typed -
"useradd -g peter peter"

Now I can get in as peter, but the access rights do not appear clear to me.

I do vaguely remember that in Unix I was able to be clear about access rights using a set of commands, but cannot remember what they were - ls, pwd, stat ....?

Also When I allocated a password to peter, the passwd process would not accept a fully alphabetic password. As above - I was using an alphabetic password. Can I change the password to all alpha?
 
Old 09-07-2004, 02:36 AM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Back to the basics ...

Linux' permissions are based on the numeric
userid's, the names are just convenience.

It appears that on that box there once was
a user peter with the numerical userid 500.

He then must have been removed, but the
home stayed ...

The one you created has the userid 2002,
and belongs to the group 500, which happens
to be the same group the other peter belonged
to.

Looking at the access rights (all users homes
have r-x for others and group) you can freely
cd into and ls and less files and all that, but you
can't write (despite the identical name).

You can do two things:
a) remove the user peter and the home directory
of peter, and start over.
b) chown -R peter:peter /home/peter

HIH


Cheers,
Tink
 
Old 09-07-2004, 02:58 AM   #9
aroundtuit
LQ Newbie
 
Registered: Sep 2004
Location: Melbourne
Distribution: Gentoo
Posts: 6

Original Poster
Rep: Reputation: 0
Thankyou all and thankyou Tinkster - changing the ownership to the new peter solved the problem for me.
 
Old 09-07-2004, 03:10 AM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Pleasure mate, even though I shouldn't be helping Ozzies ;}


Cheers,
Tink
 
Old 09-07-2004, 03:40 AM   #11
aroundtuit
LQ Newbie
 
Registered: Sep 2004
Location: Melbourne
Distribution: Gentoo
Posts: 6

Original Poster
Rep: Reputation: 0
Maybe when you have converted all the Kiwi mob to Penguins, they will all be able to swim over here.

I'd like to see all those NZers waddling up Safety Cove.

Then I could go over there and fish the Bay of Islands in more pleasant surroundings.

(Note to self - must go there before exitting this existence)

Thanks, internationally - almost
 
Old 09-07-2004, 01:46 PM   #12
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Man, that was rather harsh :)

I am starting to see why Ozzies aren't very
popular here....



Cheers,
Tink
 
Old 09-07-2004, 04:55 PM   #13
SBing
Member
 
Registered: Mar 2004
Posts: 519

Rep: Reputation: 35
Tinkster,

May I ask which part of NZ you are from (if this thread isn't OT enough) - a friend is thinking of moving there, if you live any where near Wellington (or have a friend there), do you reckon you could let me know what sort of place it is / the weather. Looking around on the internet paints a fairly nice place with weather similar to England, but a little nicer :)

Cheers

Steve
 
Old 09-07-2004, 07:09 PM   #14
servnov
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Rep: Reputation: 30
permission denied errors are fixed by getting permission. sad, but true. Experiment with chgrp, chmod, chown, and su commands.
 
Old 09-07-2004, 09:36 PM   #15
aroundtuit
LQ Newbie
 
Registered: Sep 2004
Location: Melbourne
Distribution: Gentoo
Posts: 6

Original Poster
Rep: Reputation: 0
Sorry Tinkster - not meant to be harsh - I just like fishing in solitude.
 
  


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
Create header file for existing .c file hk_michael Programming 5 02-25-2005 06:26 PM
create a new file biiiep Programming 1 04-23-2004 03:44 PM
Create file using 'touch ./tmp.$$', file tmp.3941 is created, why? huangyanfeng Linux - General 1 04-13-2004 04:36 AM
How can I create a .db file? nuzzy Linux - Software 0 07-31-2003 11:04 AM
Create a file Vexris Linux - Newbie 3 06-05-2001 05:27 PM


All times are GMT -5. The time now is 02:12 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration