LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-11-2009, 03:51 PM   #1
dodle
LQ Newbie
 
Registered: Jul 2008
Distribution: Ubuntu
Posts: 8

Rep: Reputation: 0
Can't access /root/.local as normal user


I am trying to create a script to empty the root's Trash, but am coming up with permission issues. If I am logged in as root, I can use the following command to empty the trash:

Code:
rm -r /root/.local/share/Trash/files/* /root/.local/share/Trash/info/*
But, if I try it as a sudoer I get the following output:

Code:
rm: cannot remove `/root/.local/share/Trash/files/*': No such file or directory
rm: cannot remove `/root/.local/share/Trash/info/*': No such file or directory
I tried accessing /root/.local as a normal user with nautilus, but it says that I do not have permission to view the folder (in the shell it just says that the folder does not exist). Is there some way to empty root's Trash using "sudo", so that I can finish my script?
 
Old 04-11-2009, 04:56 PM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
It appears that your script is telling 'rm' to remove the file "/root/.local/share/Trash/files/*", the star ('*') is not acting as a glob, but instead being taken as the name of a file (which of course does not exist).

I dont know why your script would act that way, so a quick fix would be to tell 'rm' the name of a actual directory to remove.
 
Old 04-11-2009, 09:39 PM   #3
dodle
LQ Newbie
 
Registered: Jul 2008
Distribution: Ubuntu
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for the reply. I found an answer at ubuntuforums.org:

Code:
sudo bash -c "exec rm -r /root/.local/share/Trash/{files,info}/*"
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to allow normal user to access a program under the root folder vitalstrike82 Slackware 2 11-08-2008 03:39 PM
How to give root access to normal user for one day. unix_anand Linux - Security 3 10-14-2008 05:45 AM
providing the root access to normal user raghuvamsi Linux - General 3 06-11-2008 12:38 AM
enable a command that requires root access for a normal user marsguy Linux - General 2 10-08-2006 09:43 AM
Give Root Access To A Normal User waknauss Linux - Security 2 11-11-2004 09:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:41 PM.

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