LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-07-2006, 08:48 AM   #16
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269

My question is, why are any of you logging in as root directly? Setup sudo, restrict access to rm -rf / and ding ding, you never have to use root's password to login and you can have root access to whatever you need by properly configuring sudoers in /etc

/me steps after installing Linux:

1. Install Linux
2. Login as root.
3. Create regular user account
4. Setup and update sudoers, giving regular user access needed using sudo
5. Change root's password to something long, hard and random, something non-related to myself and something I'll forget after a couple of minutes.
6. Logout and login as user, never use root password unless there's some type of emergency and I have to reset it the good ol fashion way, booting with rescue disk or into single user mode..
 
Old 01-08-2006, 06:13 AM   #17
Sepero
Member
 
Registered: Jul 2004
Location: Tampa, Florida, USA
Distribution: Ubuntu
Posts: 734
Blog Entries: 1

Rep: Reputation: 33
Quote:
Originally Posted by trickykid
5. Change root's password to something long, hard and random, something non-related to myself and something I'll forget after a couple of minutes.
I think that can be best achieved by issuing this as root:
passwd -l

Check out the passwd manpage.
 
Old 01-08-2006, 08:54 AM   #18
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
By the way, the OpenSolaris rm command is refusing to remove "/", "." and "..", these requests being only run by mistake anyway, see:
http://cvs.opensolaris.org/source/xr...md/rm/rm.c#200

It would probably be a good idea to implement this feature in the gnu rm command.
 
Old 01-08-2006, 08:57 AM   #19
RySk8er30
Member
 
Registered: Jul 2004
Location: Buffalo, NY
Distribution: Mandriva 2005LE
Posts: 274

Original Poster
Rep: Reputation: 30
Here is what my crontab file looks like:

Code:
# Backup my home dir every day at midnight
00 00 * * * /bin/tar czvf /backup/`/bin/date '+%Y%m%d'`.tgz /home/rzaleski
# Update my urpmi update source at 02:00
00 02 * * * urpmi.update --update
For some reason my cron jobs didn't run. Is there a way I can find out why?

Also, how can I backup everything in my home directory except for the hidden (.*) and tmp folders?

Ryan
 
Old 01-09-2006, 07:00 AM   #20
Sepero
Member
 
Registered: Jul 2004
Location: Tampa, Florida, USA
Distribution: Ubuntu
Posts: 734
Blog Entries: 1

Rep: Reputation: 33
Quote:
Originally Posted by jlliagre
By the way, the OpenSolaris rm command is refusing to remove "/", "." and "..", these requests being only run by mistake anyway, see:
http://cvs.opensolaris.org/source/xr...md/rm/rm.c#200

It would probably be a good idea to implement this feature in the gnu rm command.
Unfortunately, I doubt it will be put in. I mean, its 2006 now and these GNU tools existed even before Linux (1991). It leads me to think that if they were going to put this in, they would've done it before now.
 
Old 01-09-2006, 07:06 AM   #21
jimvin
Member
 
Registered: May 2004
Posts: 71

Rep: Reputation: 15
Quote:
Originally Posted by RySk8er30
Here is what my crontab file looks like:

Code:
# Backup my home dir every day at midnight
00 00 * * * /bin/tar czvf /backup/`/bin/date '+%Y%m%d'`.tgz /home/rzaleski
# Update my urpmi update source at 02:00
00 02 * * * urpmi.update --update
For some reason my cron jobs didn't run. Is there a way I can find out why?

Also, how can I backup everything in my home directory except for the hidden (.*) and tmp folders?

Ryan
What user is running these jobs? I assume it is being run as root or the urpmi job will certainly fail. Have you created /backup? Is your date command in /bin ir /usr/bin?

Jimvin
 
Old 01-09-2006, 07:34 AM   #22
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Århus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 619

Rep: Reputation: 45
I think the only way to delete safely is to use a script which moves the deleted files to somewhere (e.g. ~/.Trash) and automatically deletes WITH A CERTAIN DELAY. If you use 'rm -i' regularily, you start to press enter twice. And think thereafter. The problem is not only related to the root access. My lesson was doing 'rm * ~' instead of 'rm *~'.

Personally, I prefer a long delay, like a week, before the files really will be deleted.

Best,
Ott
 
Old 01-09-2006, 08:25 AM   #23
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Ah I ran into this rm -rf few weeks ago.

Impatient I was, I restored a few things which made the use of unrm impossible.

I don't know what are the result but I'm pretty sure it may help someone in a few days
 
Old 01-09-2006, 09:05 PM   #24
ash4stuff
Member
 
Registered: Aug 2003
Location: Viena
Distribution: Debian Sarge
Posts: 139

Rep: Reputation: 15
well, there are ways of recovering the data, but it might already be to late. i am not a guru, but i have had my own experiences...

if u didnt remove the harddisk inmediately after the delete, a lot of data is probably already gone.

you can use grep to look for important text files:

like this:

********

Another method of file recovery is to use grep to search for text contained in the file. This approach is unlikely to work on anything but text files, and even then it may return a partial file or a file surrounded by text or binary junk. To use this approach, you type a command such as the following:

# grep -a -B5 -A100 "Dear Senator Jones" /dev/sda4 > recover.txt

This command searches for the text Dear Senator Jones on /dev/sda4 and returns the five lines before (-B5) and the 100 lines after (-A100) that string. The redirection operator stores the results in the file recover.txt. Because this operation involves a scan of the entire raw disk device, it's likely to take a while. (You can speed matters up slightly by omitting the redirection operator and instead cutting and pasting the returned lines from an xterm into a text editor; this enables you to hit Ctrl+C to cancel the operation once it's located the file. Another option is to use script to start a new shell that copies its output to a file, so you don't need to copy text into an editor.) This approach also works with any filesystem. If the file is fragmented, though, it will only return part of the file. If you misjudge the size of the file in lines, you'll either get just part of the file or too much -- possibly including binary data before, after, or even within the target file.
******

binary files are a lot harder to recover, the easiest method is analyzing the headers from files you have, and looking for similar files headers with grep, but for this is actually very hard.

things you can try to avoid this situation, if not already mentioned somewhere:

libtrash: http://freshmeat.net/projects/libtrash/
i think this is a lot better than using aliases. only drawback is that the trashcan can grow very fast, but its very configurable.

backup, backup, backup. can never say it enough

cheers, ashley
 
Old 01-10-2006, 05:52 AM   #25
RySk8er30
Member
 
Registered: Jul 2004
Location: Buffalo, NY
Distribution: Mandriva 2005LE
Posts: 274

Original Poster
Rep: Reputation: 30
Here is what my crontab file looks like:

Code:

# Backup my home dir every day at midnight 00 00 * * * /bin/tar czvf /backup/`/bin/date '+%Y%m%d'`.tgz /home/rzaleski # Update my urpmi update source at 02:00 00 02 * * * urpmi.update --update


For some reason my cron jobs didn't run. Is there a way I can find out why?

Also, how can I backup everything in my home directory except for the hidden (.*) and tmp folders?

Ryan
 
Old 01-10-2006, 07:06 AM   #26
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Just for furture reference... because it hasn't been mentioned yet...

KDE and Gnome (I think) both have a trash container they use when you delete something within there file viewers. However, there is no "recycling bin" or "Trash" implemented on a file system level. If you remove something using the standard rm or unlink program it is gone.
 
Old 01-10-2006, 07:16 AM   #27
sailu_mvn
Member
 
Registered: Sep 2004
Location: Hyderabad
Distribution: FEDORA,REDHAT,HOST
Posts: 440
Blog Entries: 1

Rep: Reputation: 30
i will tell you some simple thing
do u know the chattr command?
after u have done your work, do the following
chattr +i * (in the /)
nothing can be deleted again
and if u do want to delete
chattr -i file or folder name
 
Old 01-11-2006, 06:43 AM   #28
RySk8er30
Member
 
Registered: Jul 2004
Location: Buffalo, NY
Distribution: Mandriva 2005LE
Posts: 274

Original Poster
Rep: Reputation: 30
Could someone help me with my cron question (posted above)?
 
Old 01-11-2006, 07:09 AM   #29
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
The crontab should be:
# m h dom mon dow user command

So you seem to be missing the "user" thingy.
To make things clean, I would suggest redirecting the output to somewhere where you have write access. So that you can see if any error occurs.
Maybe
command 2&> /backup/lastlog

exclude .* and tmp:

tar cvf back.tar --exclude=tmp --exclude=.* *
 
Old 01-12-2006, 05:13 AM   #30
ash4stuff
Member
 
Registered: Aug 2003
Location: Viena
Distribution: Debian Sarge
Posts: 139

Rep: Reputation: 15
@jtshaw, there is a way....

hmm, libtrash does exactly this:

Libtrash is more than a simple utility. It's a shared library that overrides the default actions Linux uses to delete files. Once libtrash is installed, deleted files will be moved into a subdirectory of the user's home directory named Trash. Libtrash allows users to use the normal Linux commands for deleting files, and libtrash will work with any files on the system.

It is far more flexible than traditional trashcan applications or frameworks, such as those used by GNOME or KDE, because it works automatically with any program that links dynamically against glibc - which, on the typical desktop system, is just about everything.



small howto on how to configure it:
http://www.builderau.com.au/program/...0276636,00.htm
 
  


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
I am an idiot!!!! jdmarti1 Linux - Software 5 09-23-2005 10:14 PM
I am an idiot darealgodfather Linux - Newbie 5 06-20-2005 03:04 AM
Im an Idiot. Help! didlin Linux - Newbie 2 01-03-2004 01:15 PM
I'm an idiot... smudge Slackware 13 12-25-2003 06:45 AM
Help Idiot is here again! elizabetheanera General 2 06-13-2001 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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