LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 05-06-2016, 01:29 AM   #1
rutul.5085
LQ Newbie
 
Registered: May 2016
Posts: 1

Rep: Reputation: Disabled
Question Alternative of "updatedb" on linux(Ubuntu) or Run "updatedb" without root user(with normal user)


I want to run "locate" command in a script. But it cannot find a newly created file because "updatedb" has to be executed before "locate".

But, "updatedb" requires the root access or should be run with "sudo"
Now, since it is a script I don't want to enter my password by going to terminal. It will defeat the point of script.

Is there any alternative to "updatedb" ? or Can I execute it without the "sudo" ?
 
Old 05-06-2016, 01:43 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Use "find".
 
Old 05-06-2016, 02:24 AM   #3
xamaco
Member
 
Registered: Sep 2009
Location: Bastelicaccia, Corsica
Distribution: Crux
Posts: 48

Rep: Reputation: 7
Traditionally updatedb is run by a cron job. For security reasons, locate it kind of deprecated nowadays. As svg00 suggests, find is a better alternative. Although is can be slowish on a first search, after that, due to caching it gets much faster.
 
Old 05-06-2016, 04:08 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I don't know about "deprecated" - I use "[m]locate" from choice, "find" when I have to.
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
"su root" fails when I connect with normal user thru SSH AlinFaur Linux - Security 5 02-22-2006 11:26 PM
Can't run "halt" or "reboot" as user, can somebody help? ro_nicu Slackware 4 11-01-2004 07:57 AM
normal user want to perform "init 6" by using " sudo acbenny Linux - General 3 08-08-2004 07:41 AM
su wont work, cant "su root" as a normal user lukeorun Linux - General 5 10-17-2002 07:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:40 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