LinuxQuestions.org
Visit Jeremy's Blog.
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, 02: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, 02:43 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,378

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

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, 05:08 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,378

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


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
"su root" fails when I connect with normal user thru SSH AlinFaur Linux - Security 5 02-23-2006 12:26 AM
Can't run "halt" or "reboot" as user, can somebody help? ro_nicu Slackware 4 11-01-2004 08:57 AM
normal user want to perform "init 6" by using " sudo acbenny Linux - General 3 08-08-2004 08:41 AM
su wont work, cant "su root" as a normal user lukeorun Linux - General 5 10-17-2002 08:25 AM

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

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