An LVM is a tool for managing logical volumes. It can assign disks, stripes, mirrors, and change the size of logical volumes. With LVM, a hard drive or set of hard drives is assigned to one or more physical volumes. LVM physical volumes can be put on other block devices, which could include two or …
Category: Linux
How to manually destroy an LVM volume in a Linux server?
Use the ‘dd’ command to delete the first few sectors of the physical volume, especially the first four. This will eliminate the disk’s lvm labels, which are used to figure out that the disk is a lvm disk. # dd if=/dev/zero of=/dev/sd<X><Y> bs=512 count=10 Please remember that this would make the partition useless, so a …
Reduce the size of a non-root LVM and allocate that space to the root LVM?
Using the command df <MOUNTPOINT>, find the path to the LVM logical volume device node file (LV_PATH) for the specific filesystem mount point, for instance. df /home Unmount the filesystem (necessitates stopping all access to the filesystem, e.g., for /home, all users will need to log out) Fsck the filesystem Shrink the filesystem Shrink the …
Why ansible module fails to find file on a remote source that matches a ‘with_file_glob’ attribute
To resolve this issue, create the file list in another task, or use a shell or command module to execute a copy command. Local evaluation is performed on the with_file_glob attribute. When a path to a remote source is desired, the file glob expansion will be invalid. This issue applies whenever a remote source is …
Is there an easy way to change the permission of /var/log/cups to 644 and be persistent?
To change the permissions for the CUPS log files (access log, page log, and error log), add or change the LogFilePerm directive in /etc/cups/cupsd.conf (CentOS 6 and earlier) or /etc/cups/cups/cups-files.conf (CentOS 7 and later) to the desired numeric permissions. For instance, to let anyone read the log file, set. LogFilePerm 0644 Restart the CUPS service …
A file cannot be copied, read, written, or removed even by root
The root cannot write to or read from regular files even with those specified permissions. # cp the.file /tmp/the.file.bk cp: cannot open ‘the.file’ for reading: Permission denied # lsattr the.file lsattr: Permission denied While reading flags on the.file # rm -rf the.file rm: cannot remove ‘the.file’: Permission denied # file the.file the.file: regular file, no …
How to change default permission of /var/log/messages
It is best to only change $umask once and use $FileCreateMode instead to change the mode. Add the $umask near the top of the configuration file, such as at the top of the GLOBAL DIRECTIVES section of /etc/rsyslog.conf. Make sure it is set before any $IncludeConfig directives. Use $umask 0022 to stop files from being …
Is it okay to change the permissions of files and folders inside /proc
The files in /proc directory are world-writable in CentOS. What are the effects of these permissions on the security of the Linux server? Is it ok to change their world-writable permissions? Executing the following command lists world writeable files. find / -type f -perm -002 -ls | more The files in the /proc directory are …
Is it safe to change the default permission of /var/log/btmp
Failed login attempts are logged in /var/log/btmp file. For security reasons, it is recommended to set default permission 0600 on the /var/log/btmp file. Secondly, the file should be owned by the root user. Some services like sshd do not work, if the default permission of the file is changed. The following error may be observed …
Could not change permission for files under /boot/efi in CentOS 6, 7, 8
The vfat filesystem used by /boot/efi is the cause. Despite not having the concept of permissions itself, the vfat filesystem can be mounted under Linux with any set of permissions. Unable change permission for /boot/efi/EFI/centos/grub.conf on CentOS 6 as shown below. [root@centos6 centos]# ls -ltr total 248 -rwx------ 1 root root 247570 Jan 22 2011 …
How to restrict access to a specific user when file or directory permission is 777?
To remove a user named ‘user’ access from a file/directory with full access to ‘other’. # setfacl -m u:user:- /path/to/file_or_directory The same can be done for a group named ‘groupname’; change u to g. # setfacl -m g:groupname:- /path/to/file_or_directory Check the permission with getfacl. # getfacl /path/to/file_or_directory # file: example/ # owner: root # group: …
How to copy a file with specific permission over the network ?
To copy files with specific permissions over the network,rsync utility can be used. [root@server-source ~]# rsync --chmod=u+rwx,g+rx,o+rx testingfile user@192.168.0.2: The above command will copy the testingfile in the user’s home directory, and the permissions to the copied file would be 755.
Why no permission to execute the file after it is uploaded from Windows
After transferring the file using winscp to the Linux server, you expect to have the same permission (like 777) as its parent folder but failed to get it. $ ls -ld for-john/ drwxrwxrwx. 2 peter peter 7 Jun 27 24:09 for-john/ $ pwd /home/peter/for-john $ ls -l testing.sh ====>>transfer this file using winscp from Windows …
Log files in /var/log/ have incorrect permissions after rotated with logrotate
If Permissions of newly created log files do not carry over the custom permissions of previously rotated logs, follow the steps below. Set the permissions of files as needed before rotating them. # chmod 644 /var/log/messages cd to /var/log and confirm the change in permissions. # ls -l /var/log/ | grep messages -rw-r--r--. 1 root …
File permissions of /var/cache/yum changed to 666
To resolve this issue follow below steps. Remove /var/cache/yum directory. # rm -fr /var/cache/yum List installed and enabled repositories. # yum repolist Then execute the following command to generate an updated updateinfo.xml file. # yum check-update Once the steps above are done, Check to see if the file has the wrong permissions. # find /var …