Webmin error - change permissions on directory by File Manager - centos

When i try to change permissions,owner or create directory by Webmin File manager i receive below errors
Failed to change permissions: 256
Error opening directory /%2Fhome No such file or directory
chown: cannot access `/%2Fhome/test': No such file or directory
chown: cannot access `/%2Fhome/test': No such file or directory
chmod: cannot access `/%2Fhome/test': No such file or directory
chmod: cannot access `/%2Fhome/test': No such file or directory
chmod: cannot access `/%2Fhome/test': No such file or directory
chown: cannot access `/%2Fhome/test': No such file or directory
chown: cannot access `/%2Fhome/test': No such file or directory
chmod: cannot access `/%2Fhome/test': No such file or directory
chmod: cannot access `/%2Fhome/test': No such file or directory
chmod: cannot access `/%2Fhome/test': No such file or directory
Operating system CentOS Linux 6.10
Webmin version 1.930
Kernel and CPU Linux 2.6.32-754.6.3.el6.x86_64 on x86_64
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
194G 139G 46G 76% /
tmpfs 1,9G 0 1,9G 0% /dev/shm
/dev/sda1 477M 126M 326M 28% /boot
Someone have suggestions ?

This is a bug in webmin 1.930, below the official fix.
https://github.com/webmin/webmin/commit/1f5600967f2d7873a443122db2298a06d1d7fd0b

Related

Create an image with a read write partition using a Read-only file-system on yocto

I've build a Linux image with Yocto Poky kirkstone (4.0.2) for corei7-64-poky-linux 'core-image-minimal'.
rootfs is mounted on RAM as read-only using:
IMAGE_FEATURES += "read-only-rootfs"
I'm now trying to create a new rw partition ( mounted on /usr/local) (or a RO that can be remount as RW) to store and update my application when needed.
I tried to add my own fstab using a base-files/base-files_%.bbappend (https://stackoverflow.com/a/47250915/2482513) , and adding something like:
/usr/local /usr/local ext2 defaults,rw 0 0
But this doesn't work, I can see my custom fstab (/etc/fstab) on the target, but it seems that it is not used at all.
mount -v shows:
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=852628k,nr_inodes=213157,mode=755)
/dev/loop0 on / type ext4 (ro,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /var/lib type tmpfs (rw,relatime)
I suspect yocto is using recipes-core/initrdscripts/files/init-install.sh or something similar instead of my custom fstab.
This link https://www.digi.com/resources/documentation/digidocs/embedded/dey/3.2/cc8x/yocto_t_read-only-rootfs
suggest to use volatile blinds on a read-write partition, but doesn't explain how to create that read-write partition as part of my image.
I found people using wks files to create partition in the final wic image, but I'm using hddimg (IMAGE_FSTYPES += " hddimg") for compatibility with the hardware bootloader, so I'm not sure this could work, or how to make it work.
Yocto - Create and populate a separate /home partition
I'm new to all of this, so thank you in advance for your help.
Turns out that I didn't need hddimg, you can simply create a wic image that can boot with a legacy bios using the bootimg-pcbios option:
part /boot --source bootimg-pcbios --sourceparams="loader=systemd-boot,initrd=microcode.cpio" --ondisk sda --label msdos --active --align 1024 --use-uuid

Correct Centos Partition Setup for /var/www

I am running Centos 7 and this is my df -h output.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 2.5G 48G 5% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 50M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda1 1014M 202M 813M 20% /boot
/dev/mapper/centos-home 1.4T 434M 1.4T 1% /home
tmpfs 6.3G 0 6.3G 0% /run/user/1000
tmpfs 6.3G 0 6.3G 0% /run/user/1002
I have my web files stored under /var/www and need to allocate space for it. Looking at the above output I am assuming it is stored under the root directory. I also notice that the /home directory is where the majority of my space is and I would prefer to use most of that for my /var/www directory since this will contain my web files. I'm also guessing 32GB is plenty for the /home directory since that just contains the user created folders? I'm also unsure what the last two tmpfs file systems are being used for?
I have done a lot of research but could not find any solid answer on how to do this. Any help would be appreciated. I've seen some suggestions about moving my /var/www files to the /home directory but I would prefer to keep them where there are. I also use SELinux so I don't want to have SELinux permission issues by moving them.
I personally would prefer to make a symbolic link from /var/www to /home/yourname/www.
To do this:
mkdir /home/yourname/www
rsync -avz /var/www/* /home/yourname/www
chown -R www-data:www-data /home/yourname/www
rm -r /var/www
ln -s /home/yourname/www /var/www
You can also perform local mounting from some path in your /home dir to /var/www by defining it in your /etc/fstab
Hope this help.
A symbolic link would be a good option.

Accidently renamed libc.so.6 and cannot chroot within rescue mode

We have accidently renamed shared library /lib64/libc.so.6 to be /lib64/libc.so_6. Right after previous command the system (CentOS 6.9) throws the following error :
error while loading shared libraries: /lib64/libc.so.6: cannot open shared object file: No such file or directory
When logged in within rescue mode I followed the following commands :
mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
</Code>
Then i get the following error :
/bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I also tried the following commands :
chroot /mnt /bin/bash
chroot /mnt/root/tmp /bin/bash
chroot /mnt/root/tmp /mnt/bin/bash
Then get another error
chroot: failed to run command ‘/mnt/bin/bash’: No such file or directory
Now the system is down and I only have ssh which failed once "libc.so.6" renamed, and rescue mode. How could I enter to system so that i can rename "libc.so_6" back to "libc.so.6"? Is there a work-around to bypass checking for "libc.so_6"?
For the sake of clarity, will post the answer here (in case someone else encounter similar trouble).
When in rescue mode:
mount /dev/md2 /mnt
mv /mnt/lib64/libc.so_6 /mnt/lib64/libc.so.6
Alternatively:
restore system from backup
try booting from some live USB (as Topper Harley proposed in comments)

Perl script can't unzip to mounted Windows share - permission denied

I have a simple script that is unzipping a file to a mounted Windows share. It is normally launched as a Postfix alias when a new email arrives, but even when I run it as root I get a permission denied error.
The script is doing this:
if ( </tmp/*.zip> ){
unzip '</tmp/*.zip>' => '</mnt/win/#1.txt>'
or die "unzip failed: $UnzipError\n";
}
As root I can copy files to /mnt/win without a problem, but when this script is launched by Postfix it fails with permission denied.
/etc/fstab looks like:
//srvr1/tmp /mnt/win cifs credentials=/root/.smbcredentials,iocharset=iso8859-1,sec=ntlm 0 0
ls -ld looks like:
drwxr-xr-x 2 root root 196608 Jul 15 17:24 /mnt/win
Files produced by the script are nobody/nogroup, but I'm not sure how I change the permissions of /mnt/win to allow nobody/nogroup to read/write.
cmhod -R ugo+RW /mnt/win
Also gives permission denied. Is there a way to change permissions in /etc/fstab to allow nobody/nogroup?
You need to use this command to change the permissions of folder & files inside it.
sudo chmod -R R+X /mnt/win
If you want to change the user of the file as well which is nobody/nogroup rightnow, you can use this commands :
sudo chown -R username.username /mnt/win/
Here you can choose any user's name e.g. mine is mukesh
sudo chown -R mueksh.mukesh /mnt/win/

shell script not executing despite full permissions

I have a small script that executes fine from my home folder but when moved to a different folder on different partition (EXT4)
$ ls -lah ./build.sh
-rwxrwxr-x 1 olmec(me) olmec(me) 510 Oct 31 20:00 ./build.sh
$ ./build.sh
bash: ./build.sh: Permission denied
I have tried chmod 777 build.sh but no difference.
The script is in folder /media/data/source
Data drive partition is mounted in FStab as
UUID=affd0ac6-f3da-4f88-ac22-65d94dc5da8c /media/data ext4 user,user 0 0
Resolved by modifying FStab mount command
UUID=affd0ac6-f3da-4f88-ac22-65d94dc5da8c media/data ext4 auto,users,exec 0 0
Most probably it's on a volume which was mounted with the noexec option, I'd check that. If that's not the case, you can still try to find out from strace bash yourscript's output.