date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,648,570,654,000
I'm running a read only filesystem on a raspberry pi so far everything works fine until i tried to mount /var as overlayfs for nginx and other services to work using this: VAROVRL="-o lowerdir=/var,upperdir=/mnt/persist/var-rw,workdir=/mnt/persist/var-work" mount -t overlay ${VAROVRL} overlay /var while this is worki...
The file /etc/mtab is written by the mount and umount commands. Keeping it accurate requires a bit of work because they can only update /etc/mtab if that file is available and writable. For the usual case where /etc is mounted read-write at some point during boot, distributions set up a script that rewrite /etc/mtab d...
mounting /var as overlayfs
1,648,570,654,000
I've web searched, read Where does KVM hypervisor store VM files? and consider my idea not doable by standard means, still maybe it is or can somebody advice some trick/workaround? I want to have main VM file(s) of say installed Windows in KVM (or other VM if you know how to do below for other but not KVM), store it a...
You can use copy-on-write disk images to get something like what you want. Let's assume we have a disk image windows-base.img. We'd like to use this as the "lower" image, and create multiple "upper" clones from it so we can create multiple virtual machines that start with the same base configuration. If you're working...
Any way to make Virtual Machine (e.g. KVM) use overlayfs like system to have main set of file(s) and additons separately?
1,648,570,654,000
I'm trying to mount the rootfs / of a Debian Buster system as overlayfs because I'm interested in using tmpfs for the /upper directory. My idea is to use this to preserve the root filesystem integrity by making it fake-writable. I know there are a few packages intended to do this, like fsprotect and bilibop-lockfs, ho...
Well, I didn't realized that you can choose a specific size in the mountoptions when you are mounting a tmpfs; from the tmpfs manpage: Mount options The tmpfs filesystem supports the following mount options: size=bytes Specify an upper limit on the size of the filesystem. The ...
How to control the OverlayFS size
1,648,570,654,000
We are using a Centos LXC container with the rootfs contained in a squashfs filesystem. I really like the fact that a user cannot edit the rootfs from the host. During the development, developers would infact like to make changes to the filesystem, and I'd like to move to an overlayfs. But I notice that although the u...
lxc.pre.mount gets executed before the rootfs gets loaded: lxc.hook.pre-mount = /var/lib/lxc/container0/mount-squashfs.sh lxc.rootfs.path = overlayfs:/var/lib/lxc/container0/rootfs:/var/lib/lxc/container0/delta0 And in the mount script: #!/bin/bash mount -nt squashfs -o ro /var/lib/lxc/container0/rootfs.sqsh /var/lib...
LXC Container with Overlayfs/Squashfs
1,648,570,654,000
I've been looking into using OverlayFS. I'd like to be able to combine a bunch of already formatted, already containing data, hard drives. All hard drives are formatted with ext4. The goal is to make it so I can use all the storage as one giant location. I currently make use of MergerFS so all the files contained do ...
On first glance it seems like I can only have one writable location and the other locations are just there to provide the files they have. This is correct, OverlayFS only supports one writable layer at the top. As such, I'd say it's not really suitable for the use case you describe. The goal is to make it so I can ...
How can I use OverlayFS to "combine" multiple storage into one? Is this possible?
1,648,570,654,000
or I should close file - then mount overlay - and then re-open file again? i.e. #!/bin/bash my_background_process >log.txt & ... pkill my_background_process mount overlay my_background_process >>log.txt & ... is it necessary?
Once a file is open, it stays open until the process closes it. Reading and writing from a file don't care whether the file is still available under its original name. The file may have been renamed, deleted, shadowed… it's still the same file. If you open a file /somewhere/somefile then mount a filesystem at /somewhe...
Does overlayfs redirect opened files automatically on the fly?
1,648,570,654,000
Is it possible to feed the branch paths from stdin to the mount (or mount_unionfs) command, instead of supplying them as arguments or from a file? cat ~/dirs_with_photos.txt | mount -t unionfs I don't want to use /etc/fstab, because ideally I want to automatically generate these txt files dynamically, such as with a ...
Transform the input into the required syntax and splice it into the command line with a command substitution. dirs_with_photos="$(<~/dirs_with_photos.txt tr '\n' :)" if [ -n "$dirs_with_photos" ]; then unionfs-fuse "${dirs_with_photos%:}" /photos fi With mount_unionfs you need to issue one mount command per directo...
Mount unionfs (or aufs) branches fed from stdin?
1,648,570,654,000
have mounted overlay fs: overlay on /srv/www/site type overlay (rw,relatime,lowerdir=/srv/www/site_orig,upperdir=/srv/www/site_custom,workdir=/srv/www/overlay_workdir) I can see and edit files under /srv/www/site, but apache shows that dir is empty. I tried to direct apache's doc root to /srv/www/site, to /srv/www; ...
It turned out that not the httpd was in slave namespace, but my entire X session with all graphic terminals. So I removed PrivateTmp=yes from sddm.service, and now Apache process can see my mounts
Apache does not see files under overlay mount
1,648,570,654,000
In the past our company used raspberry pi's for our IOT application. The problem with that was that SD cards wear out and get corrupt. We now ordered Compulab SBC's with eMMC storage running Debian. So what would be the best practices to configure durable embedded IOT devices? I would say: Choose an SBC with eMMC sto...
I'll try to address your first question regarding the storage device durability as I'm a bit familiar with that. Switching from SD to eMMC might not improve the situation if you don't do an accessment of your system's storage usage and take action to improve things, because both SD and eMMC use NAND. Do you have an es...
What are the best practices for configuring durable IOT Linux devices? Should I use an Overlay File System?
1,648,570,654,000
On Debian Stretch (running as root) this the current behaviour: # Create base directory mkdir base touch base/example # Create merge, upper and work directories for 2 layers mkdir layer1 layer1.upper layer1.work mkdir layer2 layer2.upper layer2.work # Mount layer1 as the merged directory using layer1.upper as the tr...
I've decided that this is a bug. As such, I've lodged a bug report with Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896646 Oops! Turns out I was doing it wrong! As noted in response to the Debian bug: overlayfs is behaving as documented. The documentation (filesystems/overlayfs.txt) says: "The specif...
(user error) OverlayFS - files deleted in current merged dir (mountpoint) reappear when merged dir remounted as lower
1,491,958,232,000
I'm mounting a filesystem as root and I don't understand why it is not owned by root but by an unprivileged user. Here's fstab: cat /etc/fstab [...] /dev/sdb /mnt/projects ext4 defaults 0 2 And here's what happens when mounting: ls -al /mnt/projects/ total 8 drwxr-xr-x 2 root root 4096 mai 25 17:55 . drwxr-...
This means that the file system being mounted contains a root directory owned by user 1000 and group 1000. The ownership of a mounted file system’s root directory becomes the ownership of the mount point.
Filesystem mounted as root but owned by user. Why?
1,491,958,232,000
I am trying to activate NordVPN CyberSec by completing the following instructions in Debian 9. I should be able to do the changes as root and with sudo like described for Ubuntu in the thread Should I edit my resolv.conf file to fix wrong DNS problem? and in the thread Linux: How do i edit resolv.conf but I cannot. ...
As per your steps, you protected the file /etc/resolv.conf from being deleted/overwritten with chattr +i (immutable) So, you won't be able to move it to another file without doing sudo chattr -i /etc/resolv.conf first. From man chattr A file with the 'i' attribute cannot be modified: it cannot be deleted or rename...
Cannot rename resolv.conf file as root
1,491,958,232,000
I copied some files to HFS+, using macOS, ensuring that it was copied exactly. On macOS these copied files have 501 as owner according to ls -han. I then plug in the HFS+ usb stick into Ubuntu, and there the files have 1000 as owner according to ls -han. Why? I then tried copying one of the 501 owned files in Ubuntu (...
From the Linux kernel documentation for the hfsplus module: Mount options uid=n, gid=n Specifies the user/group that owns all files on the filesystem that have uninitialized permissions structures. Default: user/group id of the mounting process. 501 is the default UID of the first regular user on modern macOS. So, ...
Why does `ls` in Linux and macOS show different owners (uid) for the same file?
1,491,958,232,000
I am attempting to copy a file into a directory where my user account is not the directory owner but belongs to a group that is the directory group owner. These are the steps I have taken: Create a group and add me to that group stephen@pi:~ $ sudo groupadd test-group stephen@pi:~ $ sudo usermod -a -G test-group steph...
When you did: sudo usermod -a -G test-group stephen Only the group database (the contents of /etc/group in your case) was modified. The corresponding gid was not automagically added to the list of supplementary gids of the process running your shell (or any process that has stephen's uid as their effective or real ui...
Copying a file into a directory where I am a member of the directory group
1,491,958,232,000
I have script that can be runned from different users on the same machine. This script should write logs to the same file on every run. Minimal version of script: #!/usr/bin/env bash # 2 touch /var/tmp/lll.log # 3 chmod 666 /var/tmp/lll.log # 4 (You can comment this ...
When you run this as the user armoken the file is created according to your current permissions settings, which are such that you can read/write the file but no-one else can: ls -l /var/tmp/lll.log -rw------- 9 armoken 1 May 10:52 /var/tmp/lll.log So when other users try to write to this file they have no permission...
Root couldn't write to file with rw permissions for all users and owned by other user
1,491,958,232,000
What are the standard ownership settings for files in the .gnupg folder? After doing sudo chown u:u * mine now looks like this: drwx------ 2 u u 4,0K jan 18 22:53 crls.d drwx------ 2 u u 4,0K jan 18 22:33 openpgp-revocs.d drwx------ 2 u u 4,0K jan 18 22:33 private-keys-v1.d -rw------- 1 u u 0 sep 28 02:12 pubring.g...
The .gnupg directory and its contents should be owned by the user whose keys are stored therein and who will be using them. There is in principle no problem with a root-owned .gnupg directory in your home directory, if root is the only user that you use GnuPG as (in that case one could argue that the directory should ...
What are the standard ownership settings for files in the `.gnupg` folder?
1,491,958,232,000
The problem is that I have PHP files that do not work in the browser. I suspect because the user is missing read permissions. The files are located in a dir called "ajax" drwxrwxrwx. 2 root root 4096 Sep 13 14:33 ajax The content of that dir: -rwxrwxrwx. 1 root root 13199 Sep 13 14:33 getOrderDeliveryDates.php -rwxrw...
CentOS (and other Fedora/RHEL derivatives) enables an additional security mechanism known as SELinux. It applies additional restrictions on most system daemons. These additional restrictions are checked after regular unix permissions. For non-default configurations you often need to adjust SELinux. Files contain a spe...
Cannot change permissions as root on a file owned by root
1,491,958,232,000
I have a prompt that asks me to delete all the files in a directory that the owner (u) can't r, w, nor x, in one command. I tried this command: find data -type f ! -perm -u=rwx -exec rm -f {} \; ... but I think it removes too many files.
I think you want this, which assumes that you are using GNU find specifically: find -type f \! -perm /u=rwx -exec echo rm -f {} \; Note that I added an echo for testing. If the files that get printed match your expectations, take it out. :)
Delete all files without user permissions
1,491,958,232,000
For a bash script, I need to find the numeric group ID from the file ownership attributes, similar to the output of ls -nl, but only the number. If possible, I would like to avoid big parsing magic ...
To determine only the "numerical group ID": stat -c %g /path/to/file/or/directory To determine only the "numerical user ID": stat -c %u /path/to/file/or/directory
How to get the numeric group owner of a file?
1,491,958,232,000
I want to build a tar file as regular (non-root) user with some prepared binaries and configuration files like this; etc/binaries.conf usr/bin/binary1 usr/bin/binary2 that are mean to be extracted into the file system under the / directory. Like a traditional software package .deb, .rpm etc but I need to be "package ...
The extraction is what determines the ownership, not the creation of the archive. You can see that by looking at the archive's table of contents, e.,g., tar tvf dist.tar If creating the file as regular user tar --owner 0 --group 0 dist.tar dist do the magic
Create, as a regular user, a tar with files owned by root
1,491,958,232,000
I have 5 internal drives and 3 external. I would like the internal drive's files to be owned by my default user hutber I have tried to chown them with sudo as seen here: It looks successful, however I am unsure if its possible to change, but here is my mount options for the drive And just an overview of all drivers...
Is this drive mapped in /etc/fstab? If so, you can modify the options there, this "nosuid" option need to be removed as others have pointed, and you can also add "gid=ownerGroupID, uid=ownerID" to the options list in order to have the files on the drive explicitly mapped to particular uid/gid and these be further usab...
hdd mount option to grant ownership of files on drive
1,491,958,232,000
I have a directory in my home folder containing some build output, which the build process has chown to another user (for reasons unknown to me.) I want to delete the directory, but can't because it's not empty, and I can't delete the files it contains because they are not owned by me. Of course, I could recursively c...
If you have write access to the directory, you can remove the files in it, regardless of the files' owners. The sticky bit on the directory would prevent you from removing other users' files, but if you own the directory you can just unset the bit... Same for giving yourself write access. However, a non-empty directo...
Delete a directory owned by me, containing files not owned by me
1,491,958,232,000
My apologies for the silly/simple question - yet after searching the web and SE, I cannot find an answer for this specific issue. Question: How does one change the owner and group (system-wide) only for files owned by a specific owner? Use-case: We have a number of RasPis running as various servers and use rsync to ba...
You're not using -numeric-ids and/or -fake-super for your backups (and restores). If you modify your rsync command a little you'll get the mappings saved and restored correctly. In these examples, the -M tells rsync to apply the next option, i.e. the fakery, on the remote side of the connection. An extra side effect i...
Change owner and group for specific owners only
1,491,958,232,000
I am using rsnapshot to make daily backups of a MYSQL database on a server. Everything works perfectly except the ownership of the directory is root:root. I would like it to be root:backups to enable me to easily download these backups to a local computer over an ssh connection. (My ssh user has sudo permissions but I...
In the default /etc/rsnapshot configuration file is the following: # Specify the path to a script (and any optional arguments) to run right # after rsnapshot syncs files # cmd_postexec /path/to/postexec/script You can use cmd_postexec to run a chgrp command on the resulting files which need their group ownership ch...
Rsnapshot: folder ownership permissions to 'backups' group instead of root
1,491,958,232,000
I can preserve ownership of folderB and all files and folders inside when creating and extracting a tar file as follows: tar -cpf out.tar folderA/folderB sudo tar -xpf out.tar --same-owner However, folderA is owned by root when extracting unless the folder already exists. Is there any way to preserve ownership of the...
This happens because tar -cpf out.tar folderA/folderB doesn’t store folderA as a separate object in the tarball, so it doesn’t have any way of recording the ownership and permissions of folderA. To preserve the ownership, you need to tell tar to do so when you create the tarball; with GNU tar at least, the following ...
Preserve ownership of entire folder hierarchy in tar?
1,491,958,232,000
Why I cannot change the ownership on mounting ntfs drive? I give uid=1000,gid=1000, etc in my /etc/fstab file, but found it is not working. So I'm testing it out on command line: root@host:~# mount | grep /mnt/tmp1 | wc 0 0 0 root@host:~# mount -o uid=1000 /dev/nvme0n1p4 /mnt/tmp1/ root@host:~# mou...
You're using NTFS-3g, a user-space NTFS filesystem driver. Between the kernel and any such user-space filesystem drivers, there is an interface layer called FUSE (short of Filesystem in USErspace). Note that the filesystem type is listed as fuseblk, not as ntfs or ntfs-3g. When you see type fuseblk (some options), the...
Cannot change the ownership mounting ntfs drive
1,491,958,232,000
As a non-privileged user, owning a directory on an EXT4 filesystem where I have all the necessary rights (rwx) gives me the possibility to change content and ownership of files (e.g. vim file and :w!) within it even if they are owned by root and even if I don't have the right to change them (root:root and 0644). Is th...
The owner of a directory can change the contents of the directory however they want. Even if there's a file in the directory that the directory owner isn't allowed to write, the directory owner can remove that file and create a new file by the same name. More generally, if you have write permission to a directory, the...
Change ownership of directory owned by root
1,491,958,232,000
I'm using rsync to back up a set of files in /etc. The 'source' files are on an ext4 filesystem, and the 'destination' is an ext4 partition on a USB thumb drive. My incantation is similar to this: rsync -av --recursive --files-from=my/etcfiles /etc ./my/backup/etc/ Not unexpectedly, I get errors with this including:...
Set up a root cron job and then the script will run as root anyways. To access the root crontab, run sudo crontab -e.
Can I avoid using `sudo` to back up files owned by root?
1,491,958,232,000
How do I make there be no group owner of a file in Mac OSX, since chgrp nogroup file doesn't work? If I try, the group owner doesn't change at all.
Use chgrp nobody file instead.
How do I make there be no group owner of a file in Mac OSX?
1,491,958,232,000
As you know, if there is no root_owner option, mke2fs use the user and group ID of the user running mke2fs. Let's test it on Ubuntu 22 x86_64 (mke2fs 1.46.5 (30-Dec-2021)): Generate image mke2fs -t ext2 -I 256 -E 'lazy_itable_init=0,lazy_journal_init=0' -O '^large_file' -O '^huge_file' -L ext2test 'diskEmpty.img' ...
The manpage you linked to explains well in fact that since 1.42 version the UID:GID of the root directory no longer default to those of the user running mke2fs. If, under >1.42 version you want UID:GID of the root directory to be those of the user running mke2fs, you must explicitly specify root_owner as part of the f...
mke2fs ignore root_owner
1,491,958,232,000
As far I know, a file's ownership on Linux depends on the file's owner's UID. What happens if a user in a different machine has the same UID as a user on the server and then the file is copied to the server? Who owns that file? What happens if a user on a different machine has UID that is not the same as any user on t...
Generally speaking, a non-privileged user cannot create files with different ownership than his own UID, so when he copies a file, the new file in the destination will always be owned by the UID of the user who ran the cp command. This only applies for the case that a non-privileged user (non-root) copies the files, a...
How does Linux handle permissions of files created on a different machine?
1,491,958,232,000
Background: I'm trying to share a folder between two users on the same machine . The normal way would be to have the two users in the same group set the parent folder to that group with rw and the s bit set. That works great. Except .... the folder I am trying to share is one used by Chromium. When Chromium launch...
Ok, looking like I solved this. I can open chromium from either user with exact same user-dir/profile. The trick is add all users to the acl owners list both for existing files and as default. Then to get the mask set run some chmod commands and do that all recursively. To make this easy I wrote script and it's here...
Sharing a directory between users (using ACL) when some files are created with only owner rw (600) permissions
1,491,958,232,000
we can grant the permissions as hdfs user for hive as the following su hdfs $ hdfs dfs -chown hive:2098 but how to do the opposite way? in order to verify the owner of hive and hive group?
You can execute the sample command ls hdfs dfs -ls /path And from here this is expected result: For a file returns stat on the file with the following format: permissions number_of_replicas userid groupid filesize modification_date modification_time filename For a directory it returns list of its direct children...
how to find the owner of user and group from user HDFS
1,491,958,232,000
Have a directory on a hard drive where I want to change all contents from owned by root to owned by tomc. I have tried Nemo, Krusader, and Nautilus (all launched as root, using sudo), all of which claim to be able to apply such changes recursively. None do, when I check after issuing the command. So I now have a prima...
Although you might be adverse to using chmod commands, it is one of the most direct and simple ways of doing this. You could still run the file browser with sudo as guillermo mentioned, but there is no garuntee that it'll stick and you still need to run a command in the command line to start it with sudo. chown -R tom...
Problem with recursive change of file ownership
1,491,958,232,000
I use VirtualBox 6.0.6 on Windows 10 to work in Linux Mint. I use a USB drive with a programming environment on it (Portacle). It contains an executable file (portacle.desktop). I found myself unable to run the file. A window always popped up: The application "portacle.desktop" has not been marked as trusted (executab...
The problem is that the executable on your USB drive cannot be executed with the current mount options (which are default options you did not set yourself). Also, your root/home file system within the virtual machine (VM) does not have enough space to copy over the files and execute them there. Your options are theref...
Can't run file on Linux Mint because of permissions/ownership issues
1,491,958,232,000
Let's say that my user account is homer there is a background service marge running an account bart. marge is using a directory lisa for its data. I have set the owner of lisa to bart. If I create a file and try to copy it to lisa, it fails due to permission. I can copy it by sudo cp, but then, the file's owner beco...
If you add a setgid bit on the directory bart like chmod 2775 bart; chgrp maggie bart, then all files inside the directory will have group ownership changed to maggie, and add bart to the maggie group, then anyone who is in the group maggie, like you and bart will be able to access those files. There is a setuid conc...
Copied file to have the same owner as its directory
1,491,958,232,000
Anyone know how to view all the folders within an directory with size, folder/file, owner? The only command I know of is du -hs * But that shows all the subfolders aswell and does not show owner. For example, I would like to get the info size, folder/file, owner of the folder/file under "/my/path/". Any know of comman...
You could try the find command: find /my/path -maxdepth 1 -type d -printf "%u %g " -exec du -h --max-depth=0 {} \; should locate all directories (filter -type d) one level below the starting point /my/path (option -maxdepth 1). It will then use the -printf option to print owner and group, and then invoke du --max-...
View size and owner on folders, within a folder
1,491,958,232,000
When I run ipcs -m, I can see a list of the shared memory segments on the system, like ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 0 user1 664 342110 0 0x00000000 32769 user1 664 28391740 5 0x0000...
There is no tool do this. Only ipcrm (for deleting presented shared memory objects), ipcmk (for creating shared memory objects) and ipcs (for showing existing shared memory objects) are present (I mean util-linux project). The kernel doesn't provide /proc interface for Sys V Shared Memory Objects instead of POSIX Shar...
Change ownership of shared memory
1,512,568,597,000
It may be a stupid question, but I don't understand a detail about the command chown. I haven't found any explanation for this detail yet, maybe because it's so obvious to everyone. When you change a file ownership, you can set a user parameter and a group parameter, using the following basic syntax: chown <username>:...
The "conflict" in your link refers to a non-root user. Non-root users can only change the group of a file to a group he belongs to (due to the reasons mentioned there). However, root himself could set any user and any group to any file, and the owner of the file doesn't have to belong to the group. So there's no confl...
Does chown command allow to set group different from user group?
1,512,568,597,000
An example of my question would be the /home directory: drwxr-xr-x 8 root root 4096 Jan 29 23:44 home/ So, the owner of /home is root. But I'm the owner of my personal home folder: drwx--x--- 85 teo teo 4096 Jan 30 16:22 teo/ Why is my user able to modify things under teo/ folder if the /home is owned by...
In Unix, there are files and directories (and some weird "files" like pipes and devices, but permissions on them work just like plain files), and symbolic links (in essence, files containing the name of the file they point to). A directory is just a list of file names and references to the corresponding physical files...
Why owners of files and folders can modify it's contents if they don't have permissions on the parent directory?
1,512,568,597,000
How to use pkill as su on a Mac? When I run su pkill -9 "RFBEventHelperd" in the terminal I get su: Sorry (but works as sudo). I am looking for a way to kill this process from inside a script that runs as su. My application I use SleepWatcher in MacOS to open Screen Sharing apps on wake up. After launching Screen Shar...
The form of su that you're looking for is as follows: $ su -c pkill -9 "RFBEventHelperd" <user> On OSX this form may not work. In those situations you'll likely have to yield to using sudo instead: $ sudo -u <user> <cmd> For this to run passwordless you'll have to create an entry for this in your /etc/sudoers file a...
MacOS: su pkill -9 “process_name” = sorry
1,512,568,597,000
I currently have Ubuntu installed on one partition and my personal files (Pictures, Documents, etc.) on a second partition. I would like to install KDE Neon in the partition containing Ubuntu, while keeping the personal files partition. I have yet to install Neon, but I have used a bootable USB. The problem I've run...
I don't know how to transfer ownership of files from an account on one installation to an account on another. Files are not owned by a username, they are owned by a UID. The mapping between username and UID is usually managed in the users database file /etc/passwd. Here's an example snippet root:x:0:0:root:/root:/bi...
How Do I Transfer Ownership of Files Between Distros?
1,512,568,597,000
Today, I have accidentally noticed that the following directories of the / are owned by user, rather than root: /home /lost+found /media /mnt /opt /snap /srv /swapfile /var I have no idea how that could happen. It seems only logical that some of them with the obvious exception of /home should be owned by root. If so...
They should all be owned by root. On the other hand, the system (Lubuntu 20.04 x64) runs normally. So does installed software, I do not face any troubles at the moment. Can it be the case when this saying «If it is not broken, don't fix it» is to be remembered? No. I would consider your system broken (not horrible b...
Which first level directories in Linux should be owned by user?
1,512,568,597,000
I'm running into security issues with multiple Wordpress websites, and I need to recursively change the ownership (and permissions) for folder "wp-content" (and whatever is inside them). I need to find all the folders named wp-content (there are several) and change them and all their contents so that they're owned by ...
You could use GNU find and GNU xargs to search for the wp-content directories and pass the result NUL-terminated to a shell script: find /path/to/directory -type d -name 'wp-content' -print0 | xargs -0 sh -c ' for dir; do # change user and group recursively to nginx chown -R nginx:nginx "$dir" # change ...
Find specific folders and then change their ownership
1,512,568,597,000
According to https://unix.stackexchange.com/a/489913/674 cron jobs can run as any user, without that user being logged in. root doesn’t need to log in to start the init process, thankfully (imagine handling a fleet of thousands of servers and millions of VMs otherwise); If I want to run a process, with me as its ow...
There are 3 ways to change user of a process in Unix. 2 system level ways to change user of a process if the process has capability CAP_SETUID, traditionally root has this capability (and all other capabilities), then it can use setuid, setreuid, setresuid, setfsuid, system calls, to change to any other user. Any oth...
How can I run a process as its owner or become its owner without logging in? [closed]
1,512,568,597,000
I have a multi user system and if possible I'd like to prevent downloading every game 3 times. Because of that I made a separate ext4 partition for my steam games and selected the partition in steam drwxr-xr-x 4 root root 4096 May 21 17:06 .. drwxrwxr-x 2 root steam 16384 May 4 19:59 lost+found drwxrwxr-x 3 root st...
I don't understand why I need to own the file my group has every permission There may not be any technical reason for this check but a program is free in which conditions it checks. These checks are probably done during the start-up of wine so you could create a wrapper script a sudo rule so that the wrapper scrip...
Steam not running proton games on separate EXT4 partition
1,512,568,597,000
I have two users,memsql and 4px. I have copied dir from 4px user, home dir to memsql user home dir. I want the permission for dir poc & singlestore1 to be memsql , memsql. Instead of memsql & 4px user in below logs. Logs: [memsql@rnd-2 ~]$ ls -al total 32 drwxr-x---. 3 memsql 4px 20 Jan 13 07:17 poc -rw-rw-r--. 1...
In comments you say that you used the command chown memsql singlestore1 This command would set the owner of singlestore1 to memsql. However, you appear to want to set the group to memsql. You can do this in three different ways: Set both owner and group with chown: chown memsql:memsql singlestore1 Set only group...
How to keep ownership to same user for dir
1,512,568,597,000
Typically, after installing a distro we get a root user and a sudo user. I don't know if these are typically the only users owning files (as a user/u or "owner"), are they? or are there typically more users owning files and if so, what are these?
There are typically other users owning files; which specifically depends on your distribution and the packages you have installed. You can find them by running find /usr/bin \! -user root (with other paths too, depending on what files you’re curious about). For example, on Debian-based systems, /usr/bin/man is owned ...
Typically, which file users (owners) come with a distro?
1,512,568,597,000
I'd like to know if the following scenario will update permissions, ownership, timestamps etc. Say I transfer a folder from a destination to another using rsync -zr source/ dest/, and then use the command rsync -auzr source/ dest/ - will the latter command then update the permissions, ownership, and timestamps or will...
if you want to not copy everything over you will have to do an initial run of -a --size-only which will avoid using timestamps to determine how to get things in sync. after running with --size-only, and -a rsync will correct the permissions and timestamps on the destination. After that you can use just -a which is...
Update only permissions etc. with rsync
1,512,568,597,000
I wrote this to extract the files and folder on a remote server.  It extracts them but doesn't change the owner and group of the extracted files. --- - name: Uncompressing the Tomcat source become: true ...
As follow up to Ansible: Fails at curl command I've performed the following test --- - hosts: test become: true gather_facts: false vars: VERSION: "9.0.65" tasks: - name: Uncompressing the Tomcat source unarchive: src: https://dlcdn.apache.org/tomcat/tomcat-9/v{{ VERSION }}/bin/apache-tomca...
'unarchive' module in Ansible doesn't change owner and group of extracted files and folder
1,512,568,597,000
I encountered an issue with a disk drive which I already posted on. (For the curious: Issue with device after formatting) In short, one of my disks stopped allowing me to copy files by drag and drop using Dolphin (Debian), and allowed me only if I was doing it from the terminal using sudo. I researched about my issue ...
When a drive (or partition, or other block device, or a disk image file, etc) is formatted, the top-level directory of the filesystem is owned by the user running the mkfs command. Usually, that is root unless you're formatting a disk image file (or a block device you happen to have RW perms on) as a non-root uid. If ...
Ownership, disk drives and permissions
1,512,568,597,000
I have a NAS with a directory for each member of my house. My user name, is member of each member's group. So I have access to folders of all users. I want, when I place a file, inside a user's directory, the file take the ownership from parent directory. Or get specific permissions. Directory of my wife is "zoe_folde...
I think what you are looking for, is to: Use a setgid on each user's directory, so that each new file in that directory will have the same group as the directory; and Set your system's umask to 0002, as it appears to be 0022. umask removes existing permissions from the default permissions, which is 0777 for directori...
Change owner to a file when saved in a specific folder
1,512,568,597,000
I am using Unison to synchronize files between several clients. Each client is identical, meaning that whenever one client updates a certain file, all other clients must be updated consequently. The files are stored in a centralized cloud server. Each client has non-root SSH access to the centralized cloud server. The...
I reproduced the problem you see, and looked through the very verbose debug output, and the OCaml copy.ml code (I am not familiar with this language) but did not see any obvious reason for why it could not use the copyprog setting. However, this issue from February 2017 says that copyprog only works for new files (co...
Unison: always use 'copyprog' for updates
1,512,568,597,000
So I've searched this a lot and found conflicting answers. I would appreciate, for everyone's sake, if someone could come up with a fully reasoned and cited answer for how to set ownership / permissions of /var/www/html e.g. lets say you want to access the directory using sftp but your user cannot write files there b...
From a security stand point, for me, this directory, as well as any directory that the webserver needs to go to should be set in such a way that the webserver is not the owner of the files/directories and in such a way that it has no rights to write in any directory/file. By doing so it means, whatever breach you have...
Ownership of /var/www/html [closed]
1,512,568,597,000
I have a directory on my server to which multiple users copy their data using rsync. All users use the options -a -h -v. All users are in the same group used for this directory. All users mount the share via NFS and use rsync in "local mode". While syncing the output of rsync shows several errors: rsync: failed to set...
Thank you guys for Commenting. During experiments with the suggested parameters, I discovered the cause of this error message. My question didn't include the information which was crucial for this, so it was impossible to guess the cause. I rechecked all directories and discovered that the files were out of sync. The ...
rsync permissions only for owned files
1,512,568,597,000
I know there's lot of question around the subject here but I did not found the answer yet (after many research). I have to upload the code of a web through rsync with a command line like the following: rsync -rlvz --exclude-from=exclude_list.txt -e "ssh -i /home/user/.ssh/rsa -o -p $PORT" * user@$INSTANCE_IP:/home/p...
You need to run it as root and use the --chown switch. rsync -rlvz --chown=user:group your_options source destination That will set the ownership and to your required user and group.
Prevent Rsync from changing ownership of the folder of the exclude list
1,491,737,200,000
AFAIK, the NIC receives all packets from the wire in a Local Area Network but rejects those packets which their destination address is not equal to its ip. I want to develop an application that monitors the internet usage of users. Each user has a fixed IP address. I and some other people are connected to a DES-108 8...
AFAIK, the NIC receives all packets from the wire in a Local Area Network but rejects those packets which their destination address is not equal to its ip. Correction: it rejects those packets which their destination MAC address is not equal to its MAC address (or multicast or any additional addresses in its filter....
How to capture all incoming packets to NIC even those packets are not belonging to me
1,491,737,200,000
Out of curiosity I'm reading some tutorials about transparent TOR proxies as it's quite interesting topic from a networking standpoint. As opposed to VPN gateways which just use tun/tap interfaces and are totally clear to me, TOR proxy uses a single port. All tutorials repeat the magic line: iptables -t nat -A PREROU...
Take a look at this answer: How does a transparent SOCKS proxy know which destination IP to use? Quotation: iptables overrites the original destination address but it remembers the old one. The application code can then fetch it by asking for a special socket option, SO_ORIGINAL_DST.
What does iptables -j REDIRECT *actually* do to packet headers?
1,491,737,200,000
The UDP - must listen on port. The TCP - must connect to a server. I tried netcat and socat. nc -v -u -l -p 3333 | nc -v 127.0.0.1 50000 socat -v UDP-LISTEN:3333,fork TCP:localhost:50000 Both work -- they delivered the message -- but the line is not ended. VLC will only take the command if I close netcat/socat. I mo...
I suspect your problem is more because whatever sends the UDP packets is not adding a newline character the commands (as in they should send "play\n" and not just "play"). In any case, if you want a new TCP connection to be created for each of the UDP packets, you should use udp-recvfrom instead of udp-listen in socat...
Create UDP to TCP bridge with socat/netcat to relay control commands for vlc media-player
1,491,737,200,000
We are using iptables firewall. It is logging and dropping various packages depending on its defined rules. Iptables log file entries look like: 2017-08-08T19:42:38.237311-07:00 compute-nodeXXXXX kernel: [1291564.163235] drop-message : IN=vlanXXXX OUT=cali95ada065ccc MAC=24:6e:96:37:b9:f0:44:4c:XX:XX:XX:XX:XX:XX SRC...
There are counters for each rule in iptables which can be shown with the -v option. Add -x to avoid the counters being abbreviated when they are very large (eg 1104K). For example, $ sudo iptables -L -n -v -x Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 39 2...
How to get metrics about dropped traffic via iptables?
1,491,737,200,000
Can someone give me a hint on how to setup a basic deny rule whenever any TCP request is sent to a specific IP address? I am using the PF packet filter. Any help?
The most basic form would look like this, in your /etc/pf.conf config: block from any to 192.0.2.2 # which is equivalent to: block drop from any to 192.0.2.2 By default this block action will drop packets silently on all interfaces, from any source IP, in both directions. Because a client is unaware it is being bloc...
Block outgoing connections to certain IP using PF
1,491,737,200,000
I'm trying to find a way to record the entire contents of packets (possibly with tcpdump) that have been dropped according to rules in iptables. At present, I have a rule to log these packets (with a log prefix), then follow this with a rule to drop them. Is there a way to record the contents of those packets for rev...
The NFLOG target can be used for this purpose. Here is a very basic example: # Drop traffic by default iptables -P INPUT DROP # add your whitelists here # iptables -A INPUT ... # Pass the packets to NFLOG (just like LOG, but instead of syslog, # it uses netlink). You can add extra filters such as '-p tcp' as usual i...
record contents of packets dropped in iptables
1,491,737,200,000
How do I check that packet socket support has been compiled into my kernel? I'm running Crunchbang, a Debian-based distribution.
Most Linux distributions include the config parameters used to compile the kernel in /boot/config-<kernel-version>. So grep -x 'CONFIG_PACKET=[ym]' "/boot/config-$(uname -r)" Should tell you if AF_PACKET socket support is included (m for as a module). Otherwise, you can just try and create a socket (using socket(2), ...
How do I check if I have packet socket support enabled in my distro's kernel?
1,491,737,200,000
I have question similar to this one dpkg: new pre-installation script returned error exit status 1 I'm getting error same as above when trying to install PacketTracer 7.3.1. I think I declined EULA. I know nothing about bash and debconf. Does anyone know how to modify this script? #!/bin/sh -e # Source debconf libra...
To fix the EULA selection, you can change the value stored in the debconf database directly: debconf-get-selections | grep PacketTracer_731_amd64/accept-eula | sed s/false/true/ | sudo debconf-set-selections Then configure pending packages: sudo dpkg-reconfigure --pending
Package pre-installation script subprocess returned error exit status 1
1,491,737,200,000
I want one of machine have a remote control alarm running that can be triggered by any remote machine. More precisely Machine A is running the service in the background Any remote machine B can send a packet to machine A to trigger the alarm (a command called alarm) How would you suggest do do it? I would use nc: S...
Consider this Python3 example. Server A: #!/usr/bin/env python3 # coding=utf8 from subprocess import check_call from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleXMLRPCRequestHandler # Restrict to a particular path class RequestHandler(SimpleXMLRPCRequestHandler): rpc_paths = ('/JRK75W...
Remote control alarm
1,491,737,200,000
I want to start my minecraft server when someone tries to connect to it on port 25565. I have a plugin for the server which shuts it down after x amount of minutes without players online. With a shell script I created a loop that starts the server when it shuts down: #!/bin/bash while true do # run server java...
There's a service that's already included with Linux that provides this feature, it's called xinetd. Red Hat maintains pretty good documentation on their website, titled: 2.6.4. xinetd Configuration Files. The service xinetd allows you to setup a master service that will listen on specific ports, and then launch other...
Shell script to wait for a packet from a certain port
1,491,737,200,000
According to a computation I did on the data from ifconfig, my ethernet connection between my router and computer averages 1298 bytes/packet for TX (close to the MTU of 1500) and only 131 bytes/packet for RX. What could cause such a large discrepancy in the average TX vs. RX packet sizes?
One possibility is that if you are sending data out predominantly, most of the packets coming back to your system will be ACKs, and those are going to be much smaller than the PUSH you're sending.
What can cause a large TX vs. RX average bytes/packet discrepancy?
1,491,737,200,000
I am curious if most Linux distros make it possible to intercept incoming network traffic as soon as it enters the system and filter its content based on some rules before any other client can use it or at least before it gets to a specified client. E.g., let's say I wanted to have a filter that intercepts all HTTP tr...
You need to Content-filtering not Packet-filtering . Packet filtering : Working on Port, IP, layers , redirecting , icmp, udp, and other necessary protocol. Content Filtering: Suppose you have a packet and it have a payload such as sex term.you need to drop it. Content filtering softwares: Dansguardian , SquidGuard, H...
Packet analyzer to intercept and filter incoming traffic before any client app
1,491,737,200,000
I have a task on which I have spent a lot of time. I am not fluent in Linux, but I can manage basic things. The task is to gather different types of ICMP packets. I can harvest them by tcpdump (which I prefer) or Wireshark. I am able get the ICMP types of echo reply and echo request using ping, and time exceeded using...
You can generate some of the ICMP unreachable variants with qualifiers to iptables ... -j REJECT on a separate target host. (Or a VM.) The possible qualifiers are icmp-net-unreachable, icmp-host-unreachable, icmp-port-unreachable, icmp-proto-unreachable, icmp-net-prohibited, icmp-host-prohibited, icmp-admin-prohibited...
How to get different types of ICMP
1,491,737,200,000
The following rule corrupts 5% of the packets by introducing a single bit error at a random offset in the packet: sudo tc qdisc change dev ens8 root netem corrupt 5% But recently it gave me the following error: Error: Qdisc not found. To create specify NLM_F_CREATE flag Could you kindly help me or provide me with ...
The initial default qdisc set by the kernel with special handle 0: can't be modified nor referenced. It can only be overridden by a new qdisc. Using change references the existing root qdisc, but as this can't be the default kernel's qdisc, that's an error. So the first time this netem qdisc is used, the add keyword s...
Error when trying to corrupt packets in linux terminal (netem)
1,491,737,200,000
I personally love to dig sites that I know. .Here's a wierd thing I saw up on my terminal after running dig www-contestwinners.com:- ; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> www-contestwinners.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27237 ;; flags: qr rd ra; QUERY:...
The name server you queried isn't in the US. It's much closer to you. (So, unfortunately, your Nobel will have to wait.) That trace output shows www-contestwinners.com is using CloudFlare for its DNS provider. CloudFlare operates numerous servers around the world and your query gets directed to the closest (or as best...
Dig faster than speed of light, Possible?
1,491,737,200,000
I thought TCP protocol itself will guarantee not to loose any bytes while connecting. About this viewpoint, please refer to https://stackoverflow.com/questions/23841896/will-tcp-connection-lose-packets What puzzled me was how mtr (run with TCP protocol) calculate loss? TCP just has segment rather than packets. So, wh...
Analysis From what I can gather looking over the docs & via Google it looks like mtr is tracking packet loss itself by sending traffic and then keeping track of any drops that occur due to network congestion. For example, the Linode tutorial titled: Diagnosing Network Issues with MTR states the following: The i optio...
How does MTR (run with TCP protocol) calculate the loss rate?
1,491,737,200,000
I am running MacOS(really BSD), and I want to redirect certain traffic over an ssh tunnel using a a local forward. Seems easy enough, but I am repeatedly blocked by the ambiguous "/etc/pf.conf:29: syntax error" message at every turn. I must have gone through 30 iterations of the rule by now. Additionally, I have re...
You can do it : rdr pass quick on $ext_inf inet proto tcp from any to any port 1394 -> $target port 1394
macos - local port redirection using pfctl and syntax errors
1,491,737,200,000
I was reading an article on how to sniff network packets. (of course for knowledge purposes only). I came across these particular lines. For instance, say I was sniffing traffic on the network, and you logged in to Facebook and left the Remember Me On This Computer check box checked. That signals Facebook to sen...
If the machine is compromised, everything you typed in when logging in (such as your username and password) can be compromised, so "Remember me" doesn't really matter anymore. But even if we stick to cookies only, the hacker can extract the session cookies from the browser's profile and then use them in his browser. E...
Is it bad to select remember me option in the browsers of a compromised machine?
1,491,737,200,000
How to mark all packets (inbound and outbound) for specific program/ cmd in Linux using iptables or any other firewall/ tool Given that --cmd-owner option was deprecated ref:http://www.spinics.net/lists/netfilter/msg49716.html. For example, how to mark all Firefox's packets, knowing that Firefox can spawn processes so...
A possible solution using cgroups net_cls subsystem to group certain processes group, mark the packets in this cgroup using the iptables rule with the match extension, and then use tcpdump to monitor the packets from this cgroup. by listening to an nflog interface. Preperations Creating a cgroup in the net_cls subsys...
How to mark packets by program
1,491,737,200,000
Consider the following topology: I am sending ICMP (ping) packets from host B to 10.0.1.1. They reach the target and the target answers with a reply. The connectivity works fine. When running, on host A tcpdump -i eth1 icmp: I do not see any packets tcpdump -i eth2 icmp: I see the packets Is there a way to check if...
The subject you're talking about is weak/strong Host model and Linux uses weak one by default. Is there a way to check if a packet intended to interface eth1 did reach that interface? I'd say that firewall would allow to put such a constraint. I have cases where a packet arrives on an interface of a host (the first...
How to check if a packet reached an interface in a multi-interface context?
1,491,737,200,000
I was wondering if its possible to capture all network traffic coming from a single website using tcpdump. I am interested in capturing the sizes of all incoming and outgoing packets from and to a certain website. However, something like tcpdump -n host washingtonpost.com will only (I tried this on the terminal) give ...
This is not possible. Why ? Communication-Protocol http/https is the key here. tcpdump is "only" designated to capture lower level protocol. There is no filter on tcpdump to analyze traffic in-flight and do a expansion on the filter. But this would be necessary to meat your requirements. You could use a Web-Proxy Cach...
How to capture traffic from an entire website (including external servers) using tcpdump
1,491,737,200,000
Hi all we have a system which could capture packets accordingly. The only problem now we need some codes on how to interpret the packet just like how wireshark does it so well. Anyplace we can get hold of how wireshark does it?
Anyplace we can get hold of how wireshark does it? Here. Start with some of the README files in the doc directory, such as README.design (doesn't say much, but gives a quick overall view of Wireshark) and README.dissector (discusses how dissectors are written). Bear in mind that Wireshark has been developed over th...
Wireshark packet dissection codes?
1,491,737,200,000
I am doing UDP socket programming in C. In order to listen to a port, I need to forward ports in my router. My question is how to avoid doing that and still being able to communicate over the internet, if not possible with sockets, what is the lowest level possible? In other words, every device can listen to an http s...
Usually, your ISP gives you a single IP address, and your home router does network address translation (NAT) to pretend to your ISP that all the devices in your home network are just a single device with the same address as the router itself. Because of this, if anyone wants to contact your home network from the outsi...
How to avoid forwarding ports?
1,491,737,200,000
problem: I have a TCP server and client that each listen on port 9000. I have the server and client deployed on two different hosts where traffic can only pass through port 80 between them. I want the source port (9000) to be maintained when packets are sent between them (see the SNAT rule below) so that the PREROUTIN...
This is a translation of my comment into a response. The rules should be adjusted to rely on an outbound MASQUERADE of source port to handle return packets. Thus, outgoing packets should be DNAT-ed with the rule you have, and MASQUERADE-ed with a rule: iptables -t nat -A POSTROUTING -p tcp --destination-port $PROXY_PO...
iptables: transparent tcp traffic proxy
1,491,737,200,000
On a random day I was googling iptables rules to harden my desktop, and came across this post[1]. At some point the guide mentions blocking invalid TCP packets using tcp-modules with these rules; iptables -A INPUT -p tcp -m tcp --tcp-flags ALL FIN,PSH,URG -j DROP iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,FIN SYN...
TCP is a stateful protocol, UDP is stateless, so you cannot use ctstate with it. Either you let traffic for a particular port for UDP or you don't. Also --udp-flags FIN,SYN,RST,ACK SYN is just pure nonsense. In short familiarize yourself with TCP/IP and UDP a bit before rushing to set up iptables.
Why is it that TCP packets can be modified to block invalid packets, but not UDP packets
1,491,737,200,000
I'm continuously sending packets to a UDP server after 1 second. To listen for UDP packets: ncat -klup 1234 --sh-exec "cat > /proc/$$/fd/1" However, after printing 100 packets, nothing else prints. With Wireshark I can see that packets are still being sent but on the server side nothing prints. $ ncat -klup 1234 --sh...
Stated in the ncat(1) man page -m numconns, --max-conns numconns (Specify maximum number of connections) The maximum number of simultaneous connections accepted by an Ncat instance. 100 is the default (60 on Windows). 100 is the default maximum number of connections. It can be modified with the -m ...
ncat stops listening after 100 UDP packets
1,491,737,200,000
I have been trying to figure out how many sites does firefox connect wth and for that have been using wireshark. What I have done is made a new profile and whenever I run firefox in the browser it is with $ firefox --ProfileManager --safe-mode Obviously before this command is run I run - $ script $ tshark -V -i wla...
Write the captured packet data into a file with the -w option and read it into wireshark, or capture directly in wireshark. Then select the Request item of the HTTP submenü in the Statistics menu.
how to get list of sites/domains linked to in wireshark
1,491,737,200,000
I have an IP phone on my home network that I am trying to call using SIP from outside of my home network. I have port forwarding setup, but the phone is responding with a SIP 404 message. All the documentation I've seen says to look at the incoming traffic for this connection via Wireshark. How do I do this? My comput...
Monitoring Internet Traffic in Switched Networks These days, the majority of local networks are switch-based. Unlike a hub, a switch, when it has received a packet from some port, retransmits it only to one port, where the recipient computer is connected to it. Switches maintain a table of MAC addresses and ports asso...
How can I debug traffic on a switched network with Wireshark?
1,337,779,039,000
I'd like to use the perf utility to gather measurements for my program. It runs on a shared cluster machine with Debian 9 where by default the /proc/sys/kernel/perf_event_paranoid is set to 3, therefore disallowing me to gather measurements. Before changing it, I'd like to know what the implications of this are. Is i...
It’s only security, performance isn’t affected (at least, when perf isn’t running; and even then, perf’s impact is supposed to be minimal). Changing perf_event_paranoid doesn’t change the performance characteristics of the system, whether perf is running or not. There’s a detailed discussion of the security implicatio...
Security implications of changing “perf_event_paranoid”
1,337,779,039,000
I'm interessted in getting the number of context switches a two processes in a KVM vm takes on a singel CPU over some time. Earlier i have used perf, is this best practice? And how much time is used on a context switch per CPU?
About 1.2 microseconds which is about a thousand Cycles https://eli.thegreenplace.net/2018/measuring-context-switching-and-memory-overheads-for-linux-threads/
How long time does a context switch take in Linux (ubuntu 18.04)
1,337,779,039,000
I've been trying to enable context switch events on perf and use perf script's dump from perf.data to investigate thread blocked time. So far the only two recording options that seem to be helpful are context switch and all the sched events. Here's the command I'm running on perf: perf record -g -a -F 999 -e cpu-clock...
I know this question is pretty old (Feb 16) but here a response in case it helps someone else. The problem is that you've entered the '-F 999' indicating that you want to sample the events at a frequency of 999 times a second. For 'trace' events, you don't generally want to do sampling. For instance, when I select sch...
Understanding Linux Perf sched-switch and context-switches
1,337,779,039,000
What stream does the perf command use!? I've been trying to capture it with (perf stat -x, -ecache-misses ./a.out>/dev/null) 2> results following https://stackoverflow.com/q/13232889/50305, but to no avail. Why can I not capture the input... it's like letting some fish get away!!
Older versions of perf ~2.6.x I'm using perf version: 2.6.35.14-106. Capture all the output I don't have the -x switch on my Fedora 14 system so I'm not sure if that's your actual problem or not. I'll investigate on a newer Ubuntu 12.10 system later on but this worked for me: $ (perf stat -ecache-misses ls ) > stat.lo...
What stream does perf use?
1,337,779,039,000
I'm trying to run perf on my Ubuntu Precise box, which I recently upgraded to kernel 3.11.10-03111002 (manual install). The problem is that perf and kernel versions must match, and the requested version is not available in the repositories (linux-tools-VERSION package). I can only install up to v3.8.0. What can I do? ...
Get the sources of your 3.11.10-03111002 kernel Jump to it cd ./linux-3.11.10-03111002/tools/perf Type make and hit enter. To run, type ./perf that's it. For other options type make help
Getting correct perf version
1,337,779,039,000
perf stat -d ./sample.out Output is: Performance counter stats for './sample.out': 0.586266 task-clock (msec) # 0.007 CPUs utilized 2 context-switches # 0.003 M/sec 1 cpu-migrations # 0.002 M/sec ...
Your processor does not support so many counters and too frequent switching between them, I guess. You see in the last example the last column, where the counters are multiplexed (counted only over 33% of the time). If you use small enough task (or over more cores?), they are not counted, because all of the time the o...
How to resolve <not counted> problem in perf tool?
1,337,779,039,000
I'd like to use the perf utility. I was following instructions to set up a privileged group of users who are permitted to execute performance monitoring and observability without limits (as instructed here: https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html). I added the group and limited access to ...
I was experiencing this too, and was able to get it working by building and installing the latest version of libcap from source. This may not be the best solution, but it worked for me. libcap-2.53 $ git clone https://kernel.googlesource.com/pub/scm/linux/kernel/git/morgan/libcap $ cd libcap $ git checkout libcap-2.53...
how to set capabilities (setcap) on perf
1,337,779,039,000
I ran a shell pipeline under perf stat, using taskset 0x1 to pin the whole pipeline to a single CPU. I know taskset 0x1 had an effect, because it more than doubled the throughput of the pipeline. However, perf stat shows 0 context switches between the different processes of the pipeline. So what exactly does perf st...
perf was silently failing to count context switches because you were not root. (Linux has 64k pipe buffers. In either case, you can see very close to 2 context switches per 64k transferred. Not exactly sure how that works, but I suspect it's only counting context switches away from dd, either to the other dd, or to ...
Why does `perf stat` show 0 context switches?
1,337,779,039,000
I am looking for source package of perf tool ,which I wanted to compile for ARM Linux ,I have already set up the cross compile tool chain. I have compiled the the oprofile and got it source(Oprofile-0.9.8.tar.bz2) from sourceforge.net. Can anyone point me to perf tool source ??
The source code for perf is included in the Linux kernel source tree under tools/perf.
Where Do I get Source package for Perf tool
1,337,779,039,000
I have a problem in using linux perf on a newly bought laptop: there is no available hardware cache effect in my perf list!!! Well, this is really all important information that I wish to sample!! Here is my perf list: List of pre-defined events (to be used in -e): cpu-cycles OR cycles [H...
First of all, check if the processor has even the hardware counters. Intel Haswell architecture stopped to provide hardware counters in recent processors (for some reason). Second of all, I would check if you can see hardware event through, for example papi. The command papi_native_avail should list you native events,...
Why can't I find hardware cache event in my perf list?
1,337,779,039,000
I can use perf trace as a low-overhead replacement for strace, e.g. to trace all Apache instances: perf trace -p $(pidof apache2 | tr ' ' ',') To run the trace only for up to 10 seconds: perf trace -p $(pidof apache2 | tr ' ' ',') -- sleep 10 Some example output: server ~ # perf trace -p $(pidof apache2 | tr ' ' ','...
Your hunch is correct, perf trace record isn’t recording enough data; man perf-trace suggests that it takes care of it itself, but you need to record syscalls: perf trace record -e 'raw_syscalls:*' ... Then perf trace -i perf.data will work as you’d expect.
How do I use perf trace record?
1,337,779,039,000
I'm currently running kernel 5.16.15-051615-generic - I've landed on it while diagnosing and trying to fix an audio issue. Everything works great now so I'm reluctant to go back to 5.4.0 I'd like to install and use perf, but the linux-tools-common package in apt shows version 5.4.0-107.121. I've read that you need to ...
Unfortunately the Ubuntu mainline kernel builds don’t publish packages for the kernel-related tools (perf etc.). You can try using the packaged versions of the tools; most of their functionality should work fine with a newer kernel (see Why 'perf' needs to match the exact running Linux kernel version?). You can also b...
linux-tools-common when on a newer kernel version
1,337,779,039,000
I have tried looking at the documentation for perf script, perf trace, and trace-cmd, including the list of commands in "SEE ALSO". I can trace e.g. sched:sched_process_exec "live" using perf trace -a --no-syscalls -e sched:sched_process_exec. However, it only shows the process name (e.g. ls). It does not show the P...
perf record -a --no-syscalls -e sched:sched_process_exec sh -c read | perf script (sh -c read provides a way to stop this trace, just hit Enter. If I omit this command and try to interrupt the pipeline with ctrl+C, my output is lost, probably because it also interrupts perf script). However this output is not "live"...
Is there a command to show tracepoints "live", which includes the PID?
1,337,779,039,000
Why does perf stat -a show a clock speed three times lower than my CPU is rated for? I don't think power management is an issue, because I made sure the test ran for a whole second to allow the cpu frequency to rise to maximum. # time perf stat -a -r 500 mount --make-rprivate /mnt/a Performance counter stats for 's...
The Ghz value in perf stat -a does not show the cycles per second. 4,719,000 cycles divided by 0.0016 seconds is 2.9Ghz, not 0.76Ghz. I guess what perf shows is an average of the cycles per second on each cpu core. Dividing 2.9Ghz by 0.76Ghz gives 3.8. This is not quite a whole number of cpus, but it's about right....
Why does `perf stat -a` show clock (Ghz) lower than my cpu is rated?
1,337,779,039,000
The third column from perf script seems to be close but not quite the uptime, where is that timestamp coming from? Is there a way to access that timestamp other than accessing sampled events? $ perf record cat /proc/uptime 1392597.79 16669901.66 [ perf record: Woken up 1 times to write data ] [ perf record: Captured ...
Which clock source is recorded technically depends on how perf-record(1) was run (see the description of the -k option). The undocumented default is (each) CPU’s “local” clock, which is not otherwised exposed to userspace except in dmesg but seems to be close to CLOCK_MONOTONIC... unless you suspend... I think?.. It’s...
Where does `perf script` timestamps come from?
1,337,779,039,000
It's possible to create a bitmap or a vector image out of the data collected by the perf profiler under linux ?
Take a look at this article titled: perf Examples, it has a number of examples that show how you can make flame graphs such as this one:      The above graph can be generated as an interactive SVG file as well. The graph was generated using the FlameGraph tool. This is separate software from perf. A series of commands...
Does perf includes some "graphing" abilities?