LinuxQuestions.org
Review your favorite Linux distribution.
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 12-12-2007, 03:09 PM   #1
sandeshsk007
LQ Newbie
 
Registered: Oct 2007
Posts: 14

Rep: Reputation: 0
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 03:45 PM.
 
Old 12-12-2007, 03:15 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
What do you mean?
 
Old 12-12-2007, 04:17 PM   #3
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
That won't hide your files from other users.

Forrest
 
Old 12-12-2007, 04:24 PM   #4
sandeshsk007
LQ Newbie
 
Registered: Oct 2007
Posts: 14

Original Poster
Rep: Reputation: 0
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
 
Old 12-12-2007, 04:42 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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'?
 
Old 12-12-2007, 04:47 PM   #6
sandeshsk007
LQ Newbie
 
Registered: Oct 2007
Posts: 14

Original Poster
Rep: Reputation: 0
I want a simple rename and very simple thing of to not display the filename when used with ls.
 
Old 12-12-2007, 04:49 PM   #7
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 12-12-2007, 05:31 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by forrestt View Post
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.
 
Old 12-12-2007, 05:45 PM   #9
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
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.
 
Old 12-12-2007, 05:51 PM   #10
rsashok
Member
 
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202

Rep: Reputation: 31
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
 
Old 12-12-2007, 05:59 PM   #11
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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 06:04 PM.
 
Old 12-12-2007, 06:27 PM   #12
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Quote:
Originally Posted by unSpawn View Post
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.
 
Old 12-12-2007, 07:01 PM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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
 
Old 12-13-2007, 02:11 AM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Yes, you're both right: kernel or binary subversion.
 
  


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
How to rename file while copying - and remove special characters corporal79 Linux - General 3 10-11-2007 04:16 PM
bash scripting: loop over a file, replacing two decimal numbers frankie_DJ Programming 2 04-30-2007 04:04 PM
how to rename a file and copy a file in a shell zach014 Linux - Newbie 6 11-23-2006 09:23 AM
rename file names with " ? characters fishbonz Linux - Newbie 2 05-31-2005 11:20 AM
How do I rename a file? Thaidog Linux - Newbie 5 10-10-2003 10:28 PM

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

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