Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • In most *nix operating systems, you have to be running as root (a.k.a. superuser) to create a hardlink to a directory. The operation is restricted because it can make a mess of a file system. See Linux: How does hard-linking to a directory work? Commented Oct 11, 2014 at 17:55
  • @G-Man I'm running as root, but than I use ln command, it displays an error: .... is a directory. I read manual about ln. This command in Solaris has only 3 settings: -f-n (about messages), -s (symbolic link). So I can't use ln in this case. Commented Oct 11, 2014 at 18:15
  • 3
    Oh, yes, belt and suspenders. The operating system doesn't allow a process to create a hardlink to a directory unless it's running as root -- but also the ln program doesn't allow a user (any user) to do it. (1) Check the man page for ln on your system. There may be an option (like -d or -F) to tell ln to override the restriction. (2) Check to see whether you have a link command. (3) If those don't work, try writing a one-line C program to call the link system call. Commented Oct 11, 2014 at 18:22
  • 1
    @G-Man link command works. Thank you very much. Commented Oct 11, 2014 at 18:30