can't read or write some files even as a root [Solved]

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

can't read or write some files even as a root [Solved]

Postby hatalar205 » Sat Jun 13, 2009 11:49

I have some files which can not be read or written even as a root. A kind of virus damaged these files in Windows. I could hardly move them to another external hard-disk. But now I can't open and move them. I tried as a root but still I can't.
Last edited by hatalar205 on Sat Jun 13, 2009 18:53, edited 2 times in total.
Everything is your fault. Yes, I advised you but you did.
User avatar
hatalar205
Simple Hen
 
Posts: 77
Joined: Wed May 06, 2009 16:49

Re: can't read or write some files even as a root

Postby micia » Sat Jun 13, 2009 12:05

You can't even trying in Bash?

I had this problem using Gnome, I tried with the command line and it worked,
hope it helps.
User avatar
micia
Sagely Hen
 
Posts: 2710
Joined: Wed Nov 26, 2008 16:41

Re: can't read or write some files even as a root

Postby hatalar205 » Sat Jun 13, 2009 12:08

Mine is also Gnome with Sabayon 4.2. Can you explain a bit how? If possible?
Everything is your fault. Yes, I advised you but you did.
User avatar
hatalar205
Simple Hen
 
Posts: 77
Joined: Wed May 06, 2009 16:49

Re: can't read or write some files even as a root

Postby micia » Sat Jun 13, 2009 12:19

of course I can :D

Plug your external hard drive and mount it normally, usually these are mounted in the /media
directory (usually /media/disk).

Now try to access it using bash:

Code: Select all
su
cd /media/disk

now you should be root and in your drive. Perform the operations desired with your files.
Let's assume that you want to copy the backup directory in the home of your "foo" user.
Code: Select all
cp -R backup /home/foo

(copy recursively from directory ./backup to /home/foo be sure to not overwrite anything!)

now the trouble is that the copied directory belongs to the root user, so let's change its owner.

Code: Select all
chown -R foo:users /home/foo/backup

(change owner and group of the /home/foo/backup directory and of its contents to user foo and
group users)

This is just an example, and it worked for me.
I believe that it is some policy enforced by Gnome and Nautilus, I haven't search about it too much, since
I don't use Gnome often...
User avatar
micia
Sagely Hen
 
Posts: 2710
Joined: Wed Nov 26, 2008 16:41

Re: can't read or write some files even as a root

Postby hatalar205 » Sat Jun 13, 2009 12:28

Code: Select all
hatalar205-laptop hatalar205 # cd /media/250-yeni/melih/BELGELERİM
hatalar205-laptop BELGELERİM # cp /media/250-yeni/melih/BELGELERİM /home/foo
cp: omitting directory `/media/250-yeni/melih/BELGELERİM'

I get this error message so I can't get it.
Everything is your fault. Yes, I advised you but you did.
User avatar
hatalar205
Simple Hen
 
Posts: 77
Joined: Wed May 06, 2009 16:49

Re: can't read or write some files even as a root

Postby micia » Sat Jun 13, 2009 12:34

hatalar205 wrote:
Code: Select all
hatalar205-laptop hatalar205 # cd /media/250-yeni/melih/BELGELERİM
hatalar205-laptop BELGELERİM # cp /media/250-yeni/melih/BELGELERİM /home/foo
cp: omitting directory `/media/250-yeni/melih/BELGELERİM'

I get this error message so I can't get it.


you forgot the -R option in the cp command, the cp command does not copy directories without it,
also, I assume that you don't have really a foo user, it should be replaced with your actual username,
for example if you have hatalar as your username, you should copy it in its home directory:
Code: Select all
cp -R /media/250-yeni/melih/BELGELERİM /home/hatalar

it will copy the BELGELERİM directory in the /home/hatalar directory.
(notice also that you are not forced to copy it in the home directory, just
copy it anywhere you want)

Now to change permissions to it do:
Code: Select all
chown -R  hatalar:users /home/hatalar/BELGELERİM
User avatar
micia
Sagely Hen
 
Posts: 2710
Joined: Wed Nov 26, 2008 16:41

Re: can't read or write some files even as a root

Postby hatalar205 » Sat Jun 13, 2009 12:40

I tried. For some files (which are my main problem) Reading:Permissin denied.
Everything is your fault. Yes, I advised you but you did.
User avatar
hatalar205
Simple Hen
 
Posts: 77
Joined: Wed May 06, 2009 16:49

Re: can't read or write some files even as a root

Postby micia » Sat Jun 13, 2009 12:50

apparently it is not Gnome's fault, probably your files are actually not readable, you should change their permissions.
Try to do:
Code: Select all
chmod -R u+rw /media/250-yeni/melih/BELGELERİM

this should change all the permissions for the owner of these files, adding read and write
permissions.
Once you will do that, it should be ok to copy them.

You can see the permissions on the files on your drive also with the GUI, right clicking and selecting
"Properties", there should be a "Permissions" tab.
User avatar
micia
Sagely Hen
 
Posts: 2710
Joined: Wed Nov 26, 2008 16:41

Re: can't read or write some files even as a root

Postby hatalar205 » Sat Jun 13, 2009 12:55

Unfortunately it didn't work. And terminal didn't give any error message:
Code: Select all
hatalar205-laptop hatalar205 # cd /media/250-yeni/melih/BELGELERİM
hatalar205-laptop BELGELERİM # chmod -R u+rw /media/250-yeni/melih/BELGELERİM
hatalar205-laptop BELGELERİM #
Everything is your fault. Yes, I advised you but you did.
User avatar
hatalar205
Simple Hen
 
Posts: 77
Joined: Wed May 06, 2009 16:49

Re: can't read or write some files even as a root

Postby micia » Sat Jun 13, 2009 13:00

Have you checked permissions on those files and copying them as root as before?

If the terminal didn't give you any error message, this means that the permissions have been changed
correctly, so there should be no more problems copying them using the command cp as root...
Does that command still give you the same error?
User avatar
micia
Sagely Hen
 
Posts: 2710
Joined: Wed Nov 26, 2008 16:41

Next

Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 0 guests