LinuxQuestions.org
Help answer threads with 0 replies.
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 07-06-2004, 12:40 PM   #1
Brooksias
LQ Newbie
 
Registered: Jul 2004
Posts: 12

Rep: Reputation: 0
Question How do I unlock a file?


I want to throw away some files I donwloaded but I can't because some are locked.
How do I unlock them?
Thanks.
 
Old 07-06-2004, 12:43 PM   #2
aaa
Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
First make sure that no other programs are using them (close the ones that are). Then try to delete. If your are sure nothings using the files, go to /var/lock, and delete the lock file for the file you want to delete.
Edit: use 'lsof' to list open files.

Last edited by aaa; 07-06-2004 at 12:45 PM.
 
Old 07-06-2004, 12:46 PM   #3
Mn3moniC
LQ Newbie
 
Registered: Jul 2004
Location: Berlin, Germany
Distribution: debian unstable/testing
Posts: 6

Rep: Reputation: 0
hi,

you have to change the permissions of these files using chmod or you delete this files as root ;-)

[Mn3moniC]
 
Old 07-07-2004, 11:44 AM   #4
Brooksias
LQ Newbie
 
Registered: Jul 2004
Posts: 12

Original Poster
Rep: Reputation: 0
You wrote . . .
you have to change the permissions of these files using chmod or you delete this files as root ;-)

1. How do you change permissions? Step by step please.
2. How do you delete files as root? I know how to become the su.

You wrote . .
First make sure that no other programs are using them (close the ones that are). Then try to delete. If your are sure nothings using the files, go to /var/lock, and delete the lock file for the file you want to delete.
Edit: use 'lsof' to list open files.

1. What do you mean "go to /var/lock"?
2. How do I delete the file when I get there?

Thanks for the replies!
 
Old 07-07-2004, 12:40 PM   #5
Turner
LQ Newbie
 
Registered: Jul 2004
Posts: 7

Rep: Reputation: 0
Quote:

1. How do you change permissions? Step by step please.
2. How do you delete files as root? I know how to become the su.
3. What do you mean "go to /var/lock"?
4. How do I delete the file when I get there?
Answers:
1) To change the permissions, use "chmod" from the root (su) prompt.
2) "rm /directory/where/file/is/filename.ext
3) "cd /var/lock"
4) "rm filename" (This assumes you're in the folder/directory where the file is)

But I think you just want to do the following:

1) Get to a prompt
2) su yourself
3) "cd /whereever/the/file/is"
4) "rm filename.ext"

As root, you can pretty much do anything you want. The commands you want to look into are "chmod" (which changes read/write permissions), "chown" (which changes the owner of the file), "rm" (which deletes files/directories), and "cd" (change directory) :-D

You can always "man COMMAND" to see the help file, or google it to see what people wrote online. "chmod" settings can be a bit tricky at first....Here's a web link to help you out (http://wsabstract.com/script/script2/chmodcal.shtml)

And of course you could just be lazy and ask in a forum over here. ;-)


Turner
 
Old 07-07-2004, 12:43 PM   #6
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Okay - from the top. Here are step-by-step examples.

I do not know any of the names of your file - use a pretend one - /path/to/problemfile

1. change permissions on protected file
Code:
su -
<enter the password>
# change the permissions
chmod 777 /path/to/problemfile
Now you can delete the file - if it isn't locked

2. use lsof
Code:
su -
<enter the password>
lsof /path/to/problemfile
# if nobody is using the file delete it
rm -f /path/to/problemfile
/var/lock is a file.

It has all the names of locked files and what process has those files locked.

-- Based on your responses I hope this is your home machine. If it's a box at work, you should get a LOT of training before somebody gives you su access.
 
Old 07-07-2004, 01:46 PM   #7
Brooksias
LQ Newbie
 
Registered: Jul 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Turner/Jim,
Thanks for all the help. The files are gone and the info is on record.
Brooks
 
Old 12-14-2010, 06:26 AM   #8
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 671

Rep: Reputation: 94
Less known thing about UNIX is that locks are voluntary. Programs may or may not respect the locks set on files. FOr that reason, You can edit, copy, remove, rename, move a file if you have permissions to do so. If you really want to delete that file than use rm -f for forcing the remove.
 
Old 12-14-2010, 06:49 AM   #9
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by ozanbaba View Post
Less known thing about UNIX is that locks are voluntary. Programs may or may not respect the locks set on files. FOr that reason, You can edit, copy, remove, rename, move a file if you have permissions to do so. If you really want to delete that file than use rm -f for forcing the remove.
Check the date on threads before posting! This thread was started in 2004 and was only revived by carlo.santos' advertising (which has now been reported).
 
  


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
Cannot Unlock Session sunmicroman Slackware 9 09-09-2005 04:04 PM
About Lock And Unlock George2 Programming 8 08-23-2005 11:30 PM
unlock process! UltraSoul Solaris / OpenSolaris 4 01-16-2005 04:19 AM
unlock ntfs alaios Linux - General 2 10-22-2004 04:39 AM
Xauth will not unlock a file at /home/username javpra Linux - Newbie 3 09-08-2004 07:36 PM


All times are GMT -5. The time now is 05:24 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration