LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-14-2007, 05:54 AM   #1
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453
Blog Entries: 3

Rep: Reputation: 40
Why are links such a pain in the buttom in linux?


HI all,

I've been stumbling again and again over a very silly issue with making and/or removing links in the Gnome environment.
for example when I try to make a link to folder which placed on a partition other than the OS parition of the current linux I get a permission denied message (now why the hell is that??)
why am I denied to create a simple link to a folder??
NO , the access rights are NOT read-only ! (in case you thought that)
I repeat , read-write is enabled on all drives/partitions!

and when I try to make a link to mount folder shall we say (/something) it's done successfully but when I want to get rid of it , it just won't go away !
it says something like "the link is to a different partition...etc" this problem has given me a headache , can somebody tell met what's so difficult about those links anyway!?
 
Old 04-14-2007, 06:17 AM   #2
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
At the risk of being flamed...

Links are wonderful

Gnome is rubish

KDE is cool

-----

Just saying that the access rights are not read-only is not sufficient, check if they are writable for the user you are currently logged-on as.

Another thing might be that the partition is mounted read-only, permissions would still show read/write but you wouldn't be able to create any files (symlinks are files)

If all of the above is taken care off and you are still not able to do what you want, how about opening a terminal (gnome-terminal) and trying if you can create the links yourself (man ln), and/or if you can remove them yourself (man rm,man unlink)
 
Old 04-14-2007, 07:52 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I seem to recall something about hard links not working across different partitions...

I always use soft links (ln -s)

However you are logged in, if you can take action on a file (ie read, write, or execute), then you can link to it with the same privileges.

Finally, link creation is funny about full path names. I find the easiest way is to always link "in"---ie, while in the folder where the link will be, do this:
ln -s <full path>/<filename>
(With no name for the link specified, it automatically creates the link named <filename>)

And I have never been unable to delete a soft link.
 
Old 04-14-2007, 03:37 PM   #4
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453

Original Poster
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by x_terminat_or_3
Just saying that the access rights are not read-only is not sufficient, check if they are writable for the user you are currently logged-on as.
Another thing might be that the partition is mounted read-only, permissions would still show read/write but you wouldn't be able to create any files (symlinks are files)
If all of the above is taken care off and you are still not able to do what you want, how about opening a terminal (gnome-terminal) and trying if you can create the links yourself (man ln), and/or if you can remove them yourself (man rm,man unlink)
All of what you suggested has been tried over and over again without any success.
as a remainder: I'm logging in as ROOT! all partition are enabled for read-write-execution (for the root)
and I can read , create , delete , manipulate , etc all types of files on all partition only the link files are making problems.

Quote:
always use soft links (ln -s)

However you are logged in, if you can take action on a file (ie read, write, or execute), then you can link to it with the same privileges.
Soft links?
aha , now what the hell is difference between hard and soft links?
I'm going to check out the method you suggested , but there is still something making trouble..
assuming the un-deletable links are hard links to a partition mis/placed on another one , the question is HOw do I get rid of those bloody bits ??
and finally why is this link creation so un-neccessarily complicated in linux?

and thanks
 
Old 04-14-2007, 03:42 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
First of all, stop logging in a root, please.

You can't create a hard link to another filesystem. You need to create symbolic links instead.

See the "man ln" manpage and "info coreutils" manual for more information.
 
Old 04-14-2007, 03:49 PM   #6
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453

Original Poster
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by jschiwal
First of all, stop logging in a root, please.
Why is that ?
Quote:
Originally Posted by jschiwal
You can't create a hard link to another filesystem. You need to create symbolic links instead.
See the "man ln" manpage and "info coreutils" manual for more information.
OK , I'm looking into this , but you didn't answer my question of how to remove aleady existing hard links. and what's the difference between hard and symbolic?

Btw , did I forget to mention that the partition in question is Fat32 , in case that would change anything just to let you know.

ATTENTION PLEASE - update:
OK i've figured out how to do it , first i open a console , cd to the directory where the link should exist , then type "ln -s /where/are/you/mysoandso.this mylinkname" and walla I've my shortcut in place!

NOw removing it , I just open a console , cd to location , then use "rm mylinkname" and Poof! the link gets eighty-sixed like Donald Ramsfield , hehe

what did i want to say at last? Ah yeah despite the sure knowledge that I'm gonna bath in tomato 2nite. LOL
"The way linux handles link creation/deletion is totally freaking idiotic!" a statement by entz.
not that I hate using the console , absolutely not ! I love typing commands and doing stuff like that but giving a permission denied error as if I was trying to delete the system partition or anything else in that direction just because I used the "straight forward logical" GUI way to create and delete links instead of typing ln -s ... and /or rm etc iS just plainly and unbelievably frigged up!

NONEthless , I'd like to thank you guys for giving me hints in solving another linux crisis.

Last edited by entz; 04-14-2007 at 04:41 PM.
 
Old 04-14-2007, 04:33 PM   #7
eccles42
Member
 
Registered: Jul 2006
Location: UK
Distribution: Gentoo, Gentoo, Ubuntu, Gentoo
Posts: 42

Rep: Reputation: 15
You shouldn't log in as root in normal circumstances because it's a security risk and things.
if you quickly type
rm -rf ./
but miss out the . then you've just deleted everything on your hard drive from root (/) onwards.
so the theory is only log in with the privileges you need.

I find command line is much easier and more precise then gnome.
Try:
ln -s /some/random/file stuff
Where ln is the link command, -s specified symbolic (soft) /some/random/file is the path of the file you want to create the link to, and stuff is the name of the link you're creating.

A symbolic link is a pointer to another point, the windows definition of a link basically.
A hard link is in essense creating a copy of the file without using any extra disk space. You're giving one file more than one location, if you delete one hard link, the others remain pointing to it. If you delete the last one, you delete the item.

if you want to remove a link, you should be able to do
rm stuff
if it's a link to a folder, make sure you don't have a slash on the end.

As i see it anyway...
 
Old 04-14-2007, 04:56 PM   #8
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453

Original Poster
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by eccles42
You shouldn't log in as root in normal circumstances because it's a security risk and things.
if you quickly type
rm -rf ./
but miss out the . then you've just deleted everything on your hard drive from root (/) onwards.
so the theory is only log in with the privileges you need.
Yeah yeah , theory *sigh*
well I'm the type of guy who runs around with his gun ALWAYS UNSECURED and ready to fire , IF ya know what i mean LOL
plus i don't usually use the command line to do file management (creating , copying , deleting ,etc) I prefer the GUI it's much much nicer and shall I say more "advanced" (there is a beautiful device called Mouse , which was invented so ppl can use it)
and in the worst case , I've a big gigantic 280 GB external backup HDD that holds a second copy of everything important to me.

about the possiblity of a remote attack or something , I guess the attacker will have a hard time trying to get in and even in case he/she got it , the attacker would gain full access regardless of me logged as root or not .

P.S I've edited my last post , and thanks!
 
Old 04-14-2007, 04:59 PM   #9
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
entz

Even if you have your gun always cocked and unsecured (mmm pun!), then still you shouldn't run Linux as root!

Having users with your mentality is bad because it creates a culture of people that don't care about security and that my friend is what windows is all about. So be fair to us, fellow users, and follow our advice, or go back to windows if you want an os that doesn't care about security.
 
Old 04-14-2007, 05:17 PM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The Fat32 filesystem is a foreign filesystem. The fat32 filesystem doesn't contain inodes. They are created dynamically in the VFS system after it is mounted. Since a hard link is another inode to the same file, you won't be able to create a link on a VFAT drive. I don't know if you can create a symbolic link from a Linux partition, such as a ext3 partition, and have it reference a file on a Fat32 partition. I doubt it.

Running as root is dangerous. Anything can happen, either by someone else maliciously or an accident. Suppose you wanted to delete all of the files and directories in ~/Documents/trip/ and instead of typing rm -rf ~/Documents/trip/* you accidentally typed rm -rf ~/Documents/trip /*.
This simple typo would delete your entire installation. If you ran it as a normal user, you would only delete your own files in /tmp and /home/<username>/. Also, you might realize your mistake due to all the error messages and hit Cntrl-C to cancel before the command reached your home directory.

Sometimes you need to start a config program as root. You can use kdesu or gnomesu to launch a graphical program as root, or use sudo to run a console command as root. You might want to read "man sudo" and "man visudo" to learn how to setup sudo.

Some of the console commands can get tricky, because an argument can be interpreted as either a file or a directory. For example:
mv file file2
will rename "file" to "file2" if there isn't a file directory, but move the file to file2/file if there is. Of course you could enter "mv file file2/" which would be interpreted as moving the file to a directory and fail if the directory didn't exist. The ln command allows you to create a target or targets in a directory. If there is only one target, the first form and third form (listed on the "man ln" man page) look identical.

However, your situation is due to using the wrong type of filesystem for doing this sort of thing and doesn't have to do with the ln command.

Last edited by jschiwal; 04-14-2007 at 05:31 PM.
 
Old 04-14-2007, 06:11 PM   #11
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Quote:
Originally Posted by jschiwal
I don't know if you can create a symbolic link from a Linux partition, such as a ext3 partition, and have it reference a file on a Fat32 partition. I doubt it.
You can definitely create a symbolic link from somewhere on a Linux partition to somewhere on a FAT32 partition, I have done it a number of times.

Quote:
Originally Posted by jschiwal
Running as root is dangerous. Anything can happen, either by someone else maliciously or an accident. Suppose you wanted to delete all of the files and directories in ~/Documents/trip/ and instead of typing rm -rf ~/Documents/trip/* you accidentally typed rm -rf ~/Documents/trip /*.
This simple typo would delete your entire installation. If you ran it as a normal user, you would only delete your own files in /tmp and /home/<username>/. Also, you might realize your mistake due to all the error messages and hit Cntrl-C to cancel before the command reached your home directory.

Sometimes you need to start a config program as root. You can use kdesu or gnomesu to launch a graphical program as root, or use sudo to run a console command as root. You might want to read "man sudo" and "man visudo" to learn how to setup sudo.
First of all the user said that thay don't do file management from the command line (but you don't appear to have read that).

Secondly, whatever typo one may make will have exactly the same effects whether it's done from a root login session or with sudo.

Thridly, loging in as a restricted user doen't protect any of that user's files in any way. Considering that it is the users pesonal files that are important wheras the restricted area will contain only software that is either downloaded free or installed from disks that the user could install from again, loging in as a restricted user will only protect data that is of no real value anyway.

Some members seem to think that the world will explode if anyone ever logs into their own computer as root. It won't.
 
Old 04-14-2007, 11:26 PM   #12
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
fate

It is all about limiting damage and giving one time to think. I have several logins, each with a specific task. If I log in as user A all I can damage is my user A files. Users B,C, and D files are all safe from whatever A does. If one logs in as root you can wipe out root, A,B,C and D all in one error.

Using su -, forces one to think for just that one extra second that can be the difference between whoops and whew (almost whoops).

Lazlow
 
Old 04-15-2007, 05:27 AM   #13
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by hand of fate
First of all the user said that thay don't do file management from the command line (but you don't appear to have read that).
Mishaps can happen with the mouse or when entering text in a dialog.

Quote:
Secondly, whatever typo one may make will have exactly the same effects whether it's done from a root login session or with sudo.
True, but the example I gave was in the home directory were a person wouldn't use sudo. A mishap when doing adminstrative work could be dangerous, but when when doing normal things, sudo wouldn't be used. Running normally as root is very dangerous. If you log in as root you will do more things than you need to as the root user.

Quote:
Thridly, loging in as a restricted user doen't protect any of that user's files in any way. Considering that it is the users pesonal files that are important wheras the restricted area will contain only software that is either downloaded free or installed from disks that the user could install from again, loging in as a restricted user will only protect data that is of no real value anyway.
If the command arguments of a regular users command start with a system directory, then the stream of errors would indicate a problem and allow one to abort before the personal files are wiped out. Running as root, things like deletions would be successful. Also, using sudo, the commands are logged so you would have a better chance of remembering what you did earlier in case some changes were not successful.
 
Old 04-15-2007, 05:46 AM   #14
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
I really don't understand why new Linux users have so much problem understanding the proper use of the root account. Maybe it is because of so many people being wrongly indoctrinated by microsoft.

Fact is: Linux separates root account from ordinary users for a variety of reasons, not only to prevent us from typos or carelessness, but also from malicious programs.

Running as root all the time means that any program you start has the same privileges as you, meaning ALL privileges, meaning it can access all devices connected to that pc, it can access all files, and it can access all computers that you have in your .netrc file, or that have your public key.

While this is not the end of the world, this kind of behavior is exactly what windows does. The result of that is that 99% of all spamware, scamware, virus, and other malicious software is targeted to windows.

The fact that there are (almost) no viruses targeted to Linux is not because of the incompetence of the virus writers, but of the "sane defaults" that come right of the box, meaning that any potential virus is as good as useless unless it can run as root.

And this thing of "I'm always careful" is rubish! we are humans and as such we make mistakes; if not today, then tomorrow.
 
Old 04-15-2007, 07:59 AM   #15
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by entz
and in the worst case , I've a big gigantic 280 GB external backup HDD that holds a second copy of everything important to me.
... which was mounted at the time of disaster and also got wiped
 
  


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
LXer: Linux on a Plane: What a Pain! LXer Syndicated Linux News 0 03-14-2007 06:46 PM
5 buttom mouse....how do i make this work? MadSkillzMan Linux - Hardware 3 07-30-2004 03:51 AM
Newbie in Linux pain cat Linux - Newbie 2 03-30-2004 12:42 PM
Installing Java to Linux (What a pain) Jose1267 Linux - Newbie 2 11-03-2003 05:59 PM
Links Section updated - Please add your Linux links. jeremy Linux - General 2 11-24-2001 11:35 AM

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

All times are GMT -5. The time now is 08:36 AM.

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