Skip to main content
Post Closed as "Duplicate" by Stephen Kitt linux
Image to text. Please do not paste images of text.
Source Link
ibuprofen
  • 3.1k
  • 1
  • 18
  • 34

I have an example to better illustrate what I'm talking about:

This example was taken from overthewire's wargame leviathan

$ touch tas $ ln -s /etc/leviathan_pass/leviathan3 /tmp/l2/tas ln: failed to create symbolic link '/tmp/l2/tas': File exists 

Basically I can only symlink if the file I want to link doesn't exist. I understand this issue when talking about hard links - there's no way of linking two different files as it would lead to an inode conflict (so the file must be created at the time the command is running, to assure, and I'm presuming, they both "point" to the same inode). Now when talking about soft links it doesn't make sense to me, symlinks have nothing to do with the inodes, so what could be the problem?

Thanks in advance for any help.

I have an example to better illustrate what I'm talking about:

This example was taken from overthewire's wargame leviathan

Basically I can only symlink if the file I want to link doesn't exist. I understand this issue when talking about hard links - there's no way of linking two different files as it would lead to an inode conflict (so the file must be created at the time the command is running, to assure, and I'm presuming, they both "point" to the same inode). Now when talking about soft links it doesn't make sense to me, symlinks have nothing to do with the inodes, so what could be the problem?

Thanks in advance for any help.

I have an example to better illustrate what I'm talking about:

$ touch tas $ ln -s /etc/leviathan_pass/leviathan3 /tmp/l2/tas ln: failed to create symbolic link '/tmp/l2/tas': File exists 

Basically I can only symlink if the file I want to link doesn't exist. I understand this issue when talking about hard links - there's no way of linking two different files as it would lead to an inode conflict (so the file must be created at the time the command is running, to assure, and I'm presuming, they both "point" to the same inode). Now when talking about soft links it doesn't make sense to me, symlinks have nothing to do with the inodes, so what could be the problem?

Thanks in advance for any help.

Source Link
arpg
  • 13
  • 4

Why can't I symlink a preexisting file to a target file?

I have an example to better illustrate what I'm talking about:

This example was taken from overthewire's wargame leviathan

Basically I can only symlink if the file I want to link doesn't exist. I understand this issue when talking about hard links - there's no way of linking two different files as it would lead to an inode conflict (so the file must be created at the time the command is running, to assure, and I'm presuming, they both "point" to the same inode). Now when talking about soft links it doesn't make sense to me, symlinks have nothing to do with the inodes, so what could be the problem?

Thanks in advance for any help.