/usr/bin/rsync -av --human-readable --progress /Users/$name/ --exclude=".*" --exclude="Public" /Backup/$name\ -\ $(date +%m-%d-%y) --exclude=".*/"
asked Jun 5, 2015 at 16:20
I see two possible solutions:
Note that allowing root SSH into a server is generally a bad idea. If you want to do it this way, I’d create an SSH public/private key pair (with an encrypted private key), use that for authentication, and configure the server to reject password-based SSH authentication (at least for root).
answered Jun 8, 2015 at 19:17
Gordon Davisson
16 gold badges121 silver badges150 bronze badges
chown: changing ownership of ‘/usr/bin/’: Operation not permitted
I have read many topics talking about this issue, which most of them give a solution in case you have already a backup image of your OS. Unfortunately I don’t have any backup. Is there any solution then other than reinstalling Ubuntu from scratch.
asked May 8, 2016 at 17:08
Solution:- Get in to Ubuntu Recovery Console
Start your computer and press and hold SHIFT key while booting. It will take you to the grub loader page as shown in image – 1.
Select and enter Advanced options for Ubuntu and from there select the kernel named as recovery mode as shown in image – 2.
select root – drop to root shell prompt as shown in image – 3
Now the file system is read only to Remount to Read Write run below command
# mount -o remount,rw /
Running on Amazon Linux 1.
[root@preprod-1 ]# chown root:root /s3mnt/outliers/
chown: changing ownership of ‘/s3mnt/outliers/’: Operation not permitted
[root@preprod-1 ]# chmod -x /s3mnt/outliers/
chmod: changing permissions of ‘/s3mnt/outliers/’: Operation not permitted
[root@preprod-1 ]# cd /s3mnt/outliers
[root@preprod-1 outliers]# mkdir test2
mkdir: cannot create directory ‘test2’: Operation not permitted
[root@preprod-1 ]# ls -ld /s3mnt/outliers
drwxrwxrwx 1 brutus brutus 0 Aug 2 2017 /s3mnt/outliers
[root@preprod-1 ]# ls -ld /s3mnt/
drwxrwxrwx 1 brutus brutus 0 Jan 1 1970 /s3mnt/
[root@preprod-1 ]# sestatus
SELinux status: disabled
[root@prod-1-1 via]# ls -ld /s3mnt/outliers
d--------- 1 brutus brutus 0 Jan 1 1970 /s3mnt/outliers
[root@prod-1-1 via]# ls -ld /s3mnt/
drwxrwxrwx 1 brutus brutus 0 Jan 1 1970 /s3mnt/
[root@prod-1-1 via]# cd /s3mnt/outliers
[root@prod-1-1 outliers]# mkdir test2
[root@prod-1-1 outliers]# ls -ld test2/
drwxr-xr-x 1 brutus brutus 0 Nov 25 12:45 test2/
[root@prod-1-1 outliers]# chmod -x /s3mnt/outliers/test2/
[root@prod-1-1 outliers]# ls -ld test2/
drw-r--r-- 1 brutus brutus 0 Nov 25 12:45 test2/
[root@prod-1-1 outliers]# chown root:root test2
[root@prod-1-1 outliers]# ls -ld test2/
drw-r--r-- 1 brutus brutus 0 Nov 25 12:45 test2/
[root@prod-1-1 ]# sestatus
SELinux status: disabled
Mounted as rw
per mount
cmd on both servers. Both servers have identical /etc/fstab
.
Setup on both servers is identical:
lrwxrwxrwx 1 root root 14 May 21 2018 s3mnt -> /storage/s3mnt
drwxr-xr-x 7 brutus brutus 4096 May 21 2018 storage
# mount
s3fs on /storage/s3mnt type fuse.s3fs (rw,relatime,user_id=0,group_id=0,allow_other)
When changing permissions on the mountpoint I get the expected changing ownership of Input/output error. So it’s not that. Wish it was 🙁
What else can I check to find out why I am running into the above issues on one server but not the other?
The vfat filesystem does not support permissions. When you try to modify ownership or permissions on the mount point while the partition is mounted, it applies to the root directory of the mounted file system, not the directory that you are mounting on top of.
If your goal is to make the filesystem read-only, try mounting with -o ro
.
You can do it without unmounting with mount -o remount,ro /media/MOUNT_POINT
.
Related videos on Youtube
02 : 29
Operation not permitted error when deleting as root (4 Solutions!!)
01 : 01 : 34
01 : 53
59 : 28
Behar & Bechukotai — D’var Torah with Deeper Understanding in the Sh’mittah and Yovel Jubilee year!
Assembly of Called-Out Believers
01 : 35
Ubuntu: Error: (sudo: unable to change to root gid: Operation not permitted)
Comments
In order to find a workaround for a problem I had yesterday (see the question here) I come out with another experiment.
After inserting a flash drive (vfat) and mounting its only partition I wondered: What if I change the permissions on the mount point? Well, that should solve all my problems so I proceed(as root):
At first I tried to change the owner:
root# chown root:root /media/MOUNT_POINT
Note: /media/MOUNT_POINT was created automatically by the system
What a surprise when the command answer was: Operation not permited. What? there is things that are not allowed even being root?
Ok, that don’t stopped me and then tried:
root# chown 000 /media/MOUNT_POINT
this time, no messages, but after
ls -l /media
drwx------ 4 miranda miranda 4096 Apr 10 05:41 24EE-9E3C
as you can see, the folder still have all its permissions. I tried all combinations from 000 to 666 (with a script of course) and the result was the same.
What’s happening? What I’m missing? or even more important. Can this be done?
Thanks in advance.
Is the flash media write-protected?
No, it isn’t. In fact, that’s the effect I’m looking for.
Ok. I’m aware vfat does not support permissions. I’m trying to change the permissions of the mountpoint not of the files or folders in the vfat filesystem.
While it is mounted? If so, you’re going to be affecting the root directory of the vfat partition you’re mounting. You may need to umount the partition before you chown/chmod the mount point.
You may be able to do it while mounted with:
mount -o bind /media/ /mnt; chown root:root /mnt/MOUNT_POINT
There is nothing at all in the question to indicate that it’s about MacOSX. Also, it was posted more than a year before El Capitan was released.
I am logged in as root
# whoami
root
I have a file
# ls -l /usr/share/applications/google-chrome.desktop
-rw-r--r-- 1 root root 8424 Dec 3 10:29 /usr/share/applications/google-chrome.desktop
It is a text file
# file /usr/share/applications/google-chrome.desktop
/usr/share/applications/google-chrome.desktop: UTF-8 Unicode text
I want to remove it, but am unable to due to an EPERM
error
# rm /usr/share/applications/google-chrome.desktop
rm: cannot remove ‘/usr/share/applications/google-chrome.desktop’: Operation not permitted
Attempting to touch
it fails with an EACCES
error
# touch /usr/share/applications/google-chrome.desktop
touch: cannot touch ‘/usr/share/applications/google-chrome.desktop’: Permission denied
I can’t change permissions on the file (but changing permissions on other files in the same directory is possible)
# chmod 666 /usr/share/applications/google-chrome.desktop
chmod: changing permissions of ‘/usr/share/applications/google-chrome.desktop’: Operation not permitted
Attempting to recursively change permissions on the parent directory fails because of this file
# chmod -R u+w /usr/share/applications
chmod: changing permissions of ‘/usr/share/applications/google-chrome.desktop’: Operation not permitted
Insufficient disk space is not an issue
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda9 126G 84G 36G 70% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.8G 4.0K 3.8G 1% /dev
tmpfs 780M 1.2M 779M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 152K 3.9G 1% /run/shm
none 100M 28K 100M 1% /run/user
/dev/sda7 465M 107M 331M 25% /boot
/dev/sda2 256M 56M 201M 22% /boot/efi
I have rebooted, this is still an issue.
Here is an strace
of the rm
call which fails with EPERM
# strace rm /usr/share/applications/google-chrome.desktop
execve("/bin/rm", ["rm", "/usr/share/applications/google-c"...], [/* 29 vars */]) = 0
brk(0) = 0xb87000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f65a6901000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=130454, ...}) = 0
mmap(NULL, 130454, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f65a68e1000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1845024, ...}) = 0
mmap(NULL, 3953344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f65a631b000
mprotect(0x7f65a64d6000, 2097152, PROT_NONE) = 0
mmap(0x7f65a66d6000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bb000) = 0x7f65a66d6000
mmap(0x7f65a66dc000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f65a66dc000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f65a68e0000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f65a68de000
arch_prctl(ARCH_SET_FS, 0x7f65a68de740) = 0
mprotect(0x7f65a66d6000, 16384, PROT_READ) = 0
mprotect(0x60d000, 4096, PROT_READ) = 0
mprotect(0x7f65a6903000, 4096, PROT_READ) = 0
munmap(0x7f65a68e1000, 130454) = 0
brk(0) = 0xb87000
brk(0xba8000) = 0xba8000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=7216688, ...}) = 0
mmap(NULL, 7216688, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f65a5c39000
close(3) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
newfstatat(AT_FDCWD, "/usr/share/applications/google-chrome.desktop", {st_mode=S_IFREG|0644, st_size=8424, ...}, AT_SYMLINK_NOFOLLOW) = 0
geteuid() = 0
unlinkat(AT_FDCWD, "/usr/share/applications/google-chrome.desktop", 0) = -1 EPERM (Operation not permitted)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f65a6900000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2570
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7f65a6900000, 4096) = 0
open("/usr/share/locale/en_AU/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_AU/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=63459, ...}) = 0
mmap(NULL, 63459, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f65a68f1000
close(3) = 0
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=619, ...}) = 0
mmap(NULL, 619, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f65a68f0000
close(3) = 0
open("/usr/lib/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "rm: ", 4rm: ) = 4
write(2, "cannot remove \342\200\230/usr/share/appl"..., 65cannot remove ‘/usr/share/applications/google-chrome.desktop’) = 65
open("/usr/share/locale/en_AU/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_AU/LC_MESSAGES/libc.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3100, ...}) = 0
mmap(NULL, 3100, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f65a68ef000
close(3) = 0
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1
) = 1
lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
close(0) = 0
close(1) = 0
close(2) = 0
exit_group(1) = ?
+++ exited with 1 +++
Here is an strace
of the touch
call which fails with EACCES
# strace touch /usr/share/applications/google-chrome.desktop
execve("/usr/bin/touch", ["touch", "/usr/share/applications/google-c"...], [/* 29 vars */]) = 0
brk(0) = 0x105c000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9a020af000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=130454, ...}) = 0
mmap(NULL, 130454, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a0208f000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1845024, ...}) = 0
mmap(NULL, 3953344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9a01ac9000
mprotect(0x7f9a01c84000, 2097152, PROT_NONE) = 0
mmap(0x7f9a01e84000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bb000) = 0x7f9a01e84000
mmap(0x7f9a01e8a000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9a01e8a000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9a0208e000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9a0208c000
arch_prctl(ARCH_SET_FS, 0x7f9a0208c740) = 0
mprotect(0x7f9a01e84000, 16384, PROT_READ) = 0
mprotect(0x60d000, 4096, PROT_READ) = 0
mprotect(0x7f9a020b1000, 4096, PROT_READ) = 0
munmap(0x7f9a0208f000, 130454) = 0
brk(0) = 0x105c000
brk(0x107d000) = 0x107d000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=7216688, ...}) = 0
mmap(NULL, 7216688, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a013e7000
close(3) = 0
open("/usr/share/applications/google-chrome.desktop", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 EACCES (Permission denied)
utimensat(AT_FDCWD, "/usr/share/applications/google-chrome.desktop", NULL, 0) = -1 EACCES (Permission denied)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9a020ae000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2570
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7f9a020ae000, 4096) = 0
open("/usr/share/locale/en_AU/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_AU/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=63459, ...}) = 0
mmap(NULL, 63459, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a0209f000
close(3) = 0
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=619, ...}) = 0
mmap(NULL, 619, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a0209e000
close(3) = 0
open("/usr/lib/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "touch: ", 7touch: ) = 7
write(2, "cannot touch \342\200\230/usr/share/appli"..., 64cannot touch ‘/usr/share/applications/google-chrome.desktop’) = 64
open("/usr/share/locale/en_AU/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_AU/LC_MESSAGES/libc.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3100, ...}) = 0
mmap(NULL, 3100, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a0209d000
close(3) = 0
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Permission denied", 19: Permission denied) = 19
write(2, "\n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(1) = ?
+++ exited with 1 +++
What is going on here? How can I remove this file?
Mount –all
then need to change the ownership for sudo
# chown root:root /usr/bin/sudo
give permisson for sudo
# chmod 4755 /usr/bin/sudo
# shutdown -r now
answered May 15, 2017 at 10:01
2 silver badges10 bronze badges
# mount / -n -w -o remount
Then you need to undo the damage from earlier:
# chown -R root /usr/bin
Then finally remount the file system read-only, sync and reboot:
# mount / -n -r -o remount
# sync
# reboot -f
answered May 8, 2016 at 17:18
10 silver badges12 bronze badges
FreeBSD chown Operation not permitted (для root юзера)
[root@srv01 /var]# ls -al total 140 drwxrwxr-x 26 root wheel 512 Oct 1 21:59 . drwxr-xr-x 20 root wheel 512 Aug 11 15:39 .. drwxrwxr-x 2 root operator 512 Aug 4 17:59 .snap drwxr-xr-x 2 root wheel 512 Feb 24 2008 account drwxr-xr-x 4 root wheel 512 Feb 24 2008 at drwxr-x--- 2 root audit 512 Feb 24 2008 audit drwxr-x--- 4 root wheel 512 Sep 24 13:49 backups drwxr-x--- 2 root wheel 512 Aug 5 10:15 crash drwxr-x--- 3 root wheel 512 Feb 24 2008 cron drwxr-xr-x 9 root wheel 512 Aug 29 01:33 db dr-xr-xr-x 2 root wheel 512 Feb 24 2008 empty drwxrwxr-x 2 root games 512 Aug 4 18:01 games drwx------ 2 root wheel 512 Feb 24 2008 heimdal drwxr-xr-x 3 root wheel 2048 Oct 3 03:02 log drwxrwxr-x 2 root mail 512 Sep 6 00:55 mail drwxr-xr-x 2 daemon wheel 512 Feb 24 2008 msgs drwxr-xr-x 5 root wheel 512 Feb 24 2008 named drwxr-xr-x 2 root wheel 512 Feb 24 2008 preserve drwxr-xr-x 12 root qmail 512 Sep 2 16:06 qmail drwxr-xr-x 7 root wheel 1024 Oct 2 21:51 run drwxrwxr-x 2 root daemon 512 Feb 24 2008 rwho drwxr-xr-x 13 root wheel 512 Sep 2 22:52 spool drwxrwxrwt 6 root wheel 14848 Oct 3 12:55 tmp drwx------ 2 root bin 512 Aug 28 15:56 webmin drwxr-xr-x 81 1956 1956 4608 Sep 25 16:56 www drwxr-xr-x 2 root wheel 512 Aug 5 10:15 yp [root@srv01 /var]# mount /dev/mfid0s1a on / (ufs, local) devfs on /dev (devfs, local) /dev/mfid1s1d on /home (ufs, local, soft-updates) /dev/mfid0s1d on /tmp (ufs, local, soft-updates) /dev/mfid0s1e on /usr (ufs, local, soft-updates) /dev/mfid1s1e on /var (ufs, local, soft-updates) devfs on /var/named/dev (devfs, local) Название site_xxx - просто так )) это не настоящее имя папки )))
igor_ua
(03.10.08 13:01:36 MSD)