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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-12-2007, 04:09 PM
|
#1
|
LQ Newbie
Registered: Oct 2007
Posts: 14
Rep:
|
Rename a file with hexa decimal characters
Hi all,
I am trying to rename a file with hexadecimal characters(not the regular ASCII characters)
so that i can hide my files from other users.Could you please help me out in this regard.
Thanks
Last edited by sandeshsk007; 12-12-2007 at 04:45 PM.
|
|
|
12-12-2007, 04:15 PM
|
#2
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
What do you mean?
|
|
|
12-12-2007, 05:17 PM
|
#3
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
That won't hide your files from other users.
Forrest
|
|
|
12-12-2007, 05:24 PM
|
#4
|
LQ Newbie
Registered: Oct 2007
Posts: 14
Original Poster
Rep:
|
ok ...how would i rename my file such that it is not displayed in the ls all option ? What should be done in order that the file name is not displayed when i use ls to list the file with the all option .
Thanks
|
|
|
12-12-2007, 05:42 PM
|
#5
|
Moderator
Registered: May 2001
Posts: 29,415
|
Can't you just rename the file to something innocuous and use simple encryption (like 'openssl enc -e -bf -in inputfile -out outputfile') instead of trying to dodge 'ls'?
|
|
|
12-12-2007, 05:47 PM
|
#6
|
LQ Newbie
Registered: Oct 2007
Posts: 14
Original Poster
Rep:
|
I want a simple rename and very simple thing of to not display the filename when used with ls.
|
|
|
12-12-2007, 05:49 PM
|
#7
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
ls -a, list all, does just that, it lists ALL files. Unless you can figure out how to have a file that isn't a file, you aren't going to be able to do it. You can encrypt the file so only you can open it, but you can't make it so it isn't able to be seen with ls. You can rename it to " " but even that will show up in ls.
Code:
/home/forrest% touch \ <-- there is a space here
/home/forrest% ls -la
total 32
-rw-r--r-- 1 forrest forrest 0 Dec 12 17:39 <-- there is a file called " "
drwxr-xr-x 6 forrest forrest 512 Dec 12 17:39 ./
drwxr-xr-x 11 root root 512 Feb 1 2007 ../
-rw------- 1 forrest forrest 156 Dec 11 10:33 .Xauthority
/home/forrest% rm \ <-- there is a space here
Your best bet is to get a USB key and keep your file on it in an encrypted form. Then it will only be on the system when you have it plugged in, and only you can read it.
I'm not sure I want to know why you want to do this.
HTH
Forrest
|
|
|
12-12-2007, 06:31 PM
|
#8
|
Moderator
Registered: May 2001
Posts: 29,415
|
Quote:
Originally Posted by forrestt
you can't make it so it isn't able to be seen with ls.
|
Other than dots, spaces, encryption or stego, yes you can, it's just that the effort is disproportionate and suggesting it means breaking the LQ Rules.
|
|
|
12-12-2007, 06:45 PM
|
#9
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
When you remove a file using the rm command (or directly using the unlink system call), Linux decrements the link counter for that file. When the link counter reaches 0 the file is actually deleted from the disk, but not until then.
When you create a hard link to file, the counter is incremented, so if the file is deleted using the original path, the counter gets decremented but because there is still a link to the file from the new location, it is not removed from the disk.
When a program opens a file, the link count is also incremented until either the program terminates or the file is closed in the program.
You could "hide" a file by opening it in a program, unlinking it from the directory, but keep the program running with the file open.
One could conceive of a mechanism by which a daemon process holds a file open in this manner, and will provide the data to programs via some IPC interface - perhaps using shared memory or sockets.
The snag is that if the program terminates (e.g. it crashes or the system is rebooted), the file will be lost, and of course you can't the use regular disk IO mechanisms on the file.
|
|
|
12-12-2007, 06:51 PM
|
#10
|
Member
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202
Rep:
|
Create a directory with your private access attributes, and move all your personal files there. Other users, besides root, won't be able to 'ls' on this directory, they would get: /home/your_name/my_private: Permission denied
|
|
|
12-12-2007, 06:59 PM
|
#11
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
unSpawn, I'll take your word for it. It's not something that I would think possible with standard commands (and I would hope if it is it would be considered a bug and fixed).
So, as far as I'm concerned my advice stands, "you can't make it so it isn't able to be seen with ls." You may however be able to break your file system and get it to not be seen, but I wouldn't advise that.
Also, I'm assuming this is a non-root user, otherwise, just make an unmounted filesystem.
Forrest
Last edited by forrestt; 12-12-2007 at 07:04 PM.
|
|
|
12-12-2007, 07:27 PM
|
#12
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
Quote:
Originally Posted by unSpawn
Other than dots, spaces, encryption or stego, yes you can, it's just that the effort is disproportionate and suggesting it means breaking the LQ Rules.
|
I'm assuming you're referring to some sort of kernel hack? I don't believe this is possible with only user space tools.
|
|
|
12-12-2007, 08:01 PM
|
#13
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415
|
If you set your home dir and other dirs and all files to rw only for owner (and x where reqd) and group and other perms to none (---) then only you can see them eg
rwx------ executable files only
or
rw------- non-exes
eg
chmod -R u=rw,go= *
chmod u=rwx,go= *.sh
and others eg .pl, binaries
|
|
|
12-13-2007, 03:11 AM
|
#14
|
Moderator
Registered: May 2001
Posts: 29,415
|
Yes, you're both right: kernel or binary subversion.
|
|
|
All times are GMT -5. The time now is 07:47 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|