chattr -R -i xxxxx #xxxxx为你需要修改的文件,这样就可以了。。。
下面全不是重点,扯淡。。。。
ln: creating hard link `xxx' => `/opt/xx': Operation not permitted
摘自http://www.windowslinuxosx.com/q/answers-how-do-i-remove-a-possible-hard-link-directory-to-root-625072.html
The files and directories in the .linktorootdir
directory are copied from the root directory. You can simply delete them using for example rm -rf /volume1/usbcopy/USBCopy_1303012145/.linktohomedir
.
The explanation is below.
Hardlinks to directories are theoretically possible but because of multiple reasons they are disabled in many systems including Linux. This also means that you will not be able to remove a hardlink to directory as the unlink()
syscall will not allow it.
Demonstration
root@x:~/testdir# ln -F dir1 dir1link
ln: failed to create hard link `dir1link' => `dir1': Operation not permitted
root@x:~/testdir# unlink dir1
unlink: cannot unlink `dir1': Is a directory
The shown denial is hardwired in the Linux kernel (fs/namei.c
). Here are the results of syscalls:
linkat(AT_FDCWD, "dir1", AT_FDCWD, "dir1link", 0) = -1 EPERM (Operation not permitted)
unlink("dir1") = -1 EISDIR (Is a directory)
Recognizing the two types of links
ls -l
shows l
as the first character of the type/permission field. stat
output shows symbolic link
.ls -i
shows the same inode number for all files hardlinked to the same data (represented by inode). The second column of ls -l
shows the number of hardlinks to the inode.
user1@x:~/testdir$ ls -li
total 12
6865008 drwxrwxr-x 2 user1 user1 4096 Jul 30 00:50 dir1
6822146 lrwxrwxrwx 1 user1 user1 4 Jul 30 01:44 dir1symlink -> dir1
6822155 -rw-rw-r-- 2 user1 user1 64 Jul 30 01:44 file1
6822155 -rw-rw-r-- 2 user1 user1 64 Jul 30 01:44 file1hardlink
user1@x:~/testdir$ stat * | grep -E '((File)|(Size)|(Device)):'
File: `dir1'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 807h/2055d Inode: 6865008 Links: 2
File: `dir1symlink' -> `dir1'
Size: 4 Blocks: 0 IO Block: 4096 symbolic link
Device: 807h/2055d Inode: 6822146 Links: 1
File: `file1'
Size: 64 Blocks: 8 IO Block: 4096 regular file
Device: 807h/2055d Inode: 6822155 Links: 2
File: `file1hardlink'
Size: 64 Blocks: 8 IO Block: 4096 regular file
Device: 807h/2055d Inode: 6822155 Links: 2
.linktorootdir
In the .dfmdesk
directory DFM creates some links during the first start. These links will be shown as icons on the desktop. Between the links there will be two links to directories:.linktorootdir
as a symlink to the root directory of the system DFM is running on and also.linktohomedir
. See the DFM documentation and the DFM source.
In your case the directories /
and /volume1/usbcopy/USBCopy_1303012145/.linktohomedir
are on different filesystems (/dev/root
and /dev/vg1000/lv
) so they cannot be hardlinks to the same inode. (Hardlinks can point just in the scope of a single filesystem.)
We can guess how the problem you describe emerged. Most probably the backup to NTFS was able to keep the symlink as NTFS has this capability. Later when you copied the backup from the USB drive the copying tool did not handle symlinks as expected. Instead of copying just the symbolic link itself, the tool followed the symbolic links on the source drive and copied the content of them (root directory in the case of .linktorootdir
). The similar problem is describe also in the Synology forum: USBCopy cought in infinity loop while copying HDD.
The solution is described at the beginning.
chown root.root / home/user1/.profile ln / home/user1/.profile / home/user2/.profile ln / home/user1/.profile / home/user3/.profile ... (For all users)
Hello,
I do not understand the following lines
Code:
linux: / usr / lib / openoffice / share / fonts # ln-v-d / usr/X11R6/lib/X11/fonts/TT / create hard link `. / dd 'to` / usr/X11R6/lib/X11/fonts/TT' Ln: creating hard link `. / Dd 'to `/ usr/X11R6/lib/X11/fonts/TT ': Operation not permitted linux: / usr / lib / openoffice / share / fonts # |
#
2
20-08-2010
|
|||
|
|||
Re: How to create Hard Link in Linux
A hard link is a directory entry that references the same inode as another directory entry (only working in the same file system). One should therefore avoid very sparingly and use only with good reason. If possible you should SymLinks favor, because hard links are difficult to understand something as symlinks, and are also not all programs be supported and you may want / would imagine it. Absolutely common for the uninitiated copy (not!) way, is something like:
Code:
chown root.root / home/user1/.profile ln / home/user1/.profile / home/user2/.profile ln / home/user1/.profile / home/user3/.profile ... (For all users)
|
> Ln-v-d / usr/X11R6/lib/X11/fonts/TT /
ln one
-D,-F, - directory