- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- What's the deal with Dot Files and why are they so...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:47 AM
тАО07-17-2002 07:47 AM
I had a user's directory I was trying to work
with. Here what I found:
#cd ~kelli
#ll -a | more
kelli adm .
mike common ..
(all the other files were owned by kelli).
So I didn't understand why this other user
id was showing up as the owner of her ..
file.
OK in my brillant wisdom, I became user
user (sudo) and did this:
%cd ~kelli
%chown kelli:adm .*
Now very bad things happened. No one could
log into the server. I had to fix the
/opt/home directorie permisson from
root:root to root:common.
My question is what is the purpose of these
dot files, you can't look at them and they
seem to be very dangerous to change permissions
on.
TIA,
Laurie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:52 AM
тАО07-17-2002 07:52 AM
Re: What's the deal with Dot Files and why are they so dangerous?
. is current directory
.. is the parent directory
They are not files. So changing permissions on them will change the permissions on the 'corresponding' directories.
Very bad things can happen particularly if they are not dealt carefully.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:54 AM
тАО07-17-2002 07:54 AM
Re: What's the deal with Dot Files and why are they so dangerous?
HTH
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:57 AM
тАО07-17-2002 07:57 AM
Re: What's the deal with Dot Files and why are they so dangerous?
.* matched BOTH of these in addition to any regular files (.profile,.dtprofile). It was changing the permission of the parent directory that really killed you. This was a case of that dumb computer doing just what it was told.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:57 AM
тАО07-17-2002 07:57 AM
Re: What's the deal with Dot Files and why are they so dangerous?
The . files are reference to your current directory . and .. is a reference to the parent directory of the current directory
so if you are in /home/
cd ../
or if you are in
/var/local/scheduler/config/window1
and wish to get to
/var/local/scheduler/bin
cd ../../bin
An example of the . usage to execute a programme
cd /var/opt/ignite/bin
./make_recovery -ACv
instead of
/opt/ignite/bin/make_recovery -Acv
HTH
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:58 AM
тАО07-17-2002 07:58 AM
SolutionHidden files are generally used for configuration and startup files, like .profile, .kshrc, .hosts. They are also used to hide things. So hackers use them, and some folks use them for history (copy /etc/syslog.conf to /etc/.old.syslog.conf).
There are two files (. and ..) that appear in every long listing. The first (.) is the current working directory. The second (..) is the parent directory. So if you are in /tmp/testing, and you "cd .", you will wind up in /tmp/testing. If you "cd ..", you will wind up in /tmp.
When you did chown on .*, you changed the parent directory. So if you were in /home/kelli, you changed ownership of /home. The user should not own /home.
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 07:59 AM
тАО07-17-2002 07:59 AM
Re: What's the deal with Dot Files and why are they so dangerous?
chmod kelli:adm .* changed permissions for the parent directory, in this case for the directory /opt/home.
"." and ".." are special entries in each directory, "." stands for the directory itself, and ".." for the parent directory. You cannot remove these entries out of a directory because they are used to find files and directories and to check permissions which user is allowed to do something. So if you do a chown on .. you change permissions for the parent directory.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 08:31 AM
тАО07-17-2002 08:31 AM
Re: What's the deal with Dot Files and why are they so dangerous?
% cd ~kelli
% ls .*
% ls .[a-z]*
You'll see the difference here (I'm assuming all the "dot" files in your home directory only uses alphabetical chars).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 08:37 AM
тАО07-17-2002 08:37 AM
Re: What's the deal with Dot Files and why are they so dangerous?
one thing i forgot to mention:
ls -a directory_name (-a show all entries)
--> shows all files and directory entries, together with "." and ".."
ls -A directory_name (-A show allmost all entries)
--> shows all files and directory entries, but without "." and ".."
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2002 03:51 PM
тАО07-17-2002 03:51 PM
Re: What's the deal with Dot Files and why are they so dangerous?
It is not dot files that are dangerous, it is .*
Remember that the shell is preprocessing what you typee *before* it sends it to the command. So .* does not produce a list of only dot files. The shell interprets * as ZERO or more matches of anything, including more dots.
The best way to learn about shell filename expansion (or globbing) is to use echo *BEFORE* you type a dangerous command. I do it this way:
echo chown kelli:adm .*
Notice that the shell has replaced .* with all the filenames that match--and the critical file is .. which is the parent directory.
NEVER use .* and you'll be safe. Many new sysadmins have destroyed their user directories by:
cd /home/user1
rm -r * .*
The first * is OK...it matches all the files and directories in /home/user1, but the second will return (among all the local dot files): rm -r .. and that means: remove the entire /home directory and every subdirectory in it! Big oops!
Get in the habit of never using .* in the shell when you mean: all dotfiles, and use something like this:
echo .[a-zA-Z0-9]*
which means: find all files that start with . followed by any alphanumeric character. Note, this will miss a file such as: .% but I wouldn't want those filenames in my directories anyways.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-18-2002 12:18 AM
тАО07-18-2002 12:18 AM
Re: What's the deal with Dot Files and why are they so dangerous?
Please, even if you understand the shell's globbing and substitution mechanisms, before an rm (especially as root) always double check with an ls or echo before how the shell is expanding the meta characters.
For instance if you only want to get the dot files (which are a user's personal configuration files, and might contain hours of elaborate work!) you can use this:
# ls -d .[!.]*
.ICEauthority .cpan .profile .ssh
.TTauthority .dt .hh .q4rc.pl .sw
.Xauthority .dtprofile .inputrc .rhosts .vbtrc
.adsmrc .elm .kshrc .rhosts.org
.bashrc .exrc .netscape .sh_history
The square brackets [ ] contain character sets, and the bang or exclamation mark negates the chosen set (unfortunatley in most regular expressions the carret ^is used to signify the inversion of a set.
The asterisk * is expanded by the shells globbing mechanism to anything.
Some promoted .[a-zA-Z0-9]*
but as far as I know the underscore also is a valid identifier character.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-18-2002 01:32 AM
тАО07-18-2002 01:32 AM
Re: What's the deal with Dot Files and why are they so dangerous?
Regards,
Trond