Tag Info

Hot answers tagged

26

The tool to display inode detail for a filesystem will be filesystem specific. For the ext2, ext3, ext4 filesystems (the most common Linux filesystems), you can use debugfs, for XFS xfs_db, for ZFS zdb. For btrfs some information is available using the btrfs command. For example, to explore a directory on an ext4 filesystem (in this case / is dev/sda1): # ...


8

TO ADDRESS YOUR EDIT: I didn't notice the edit to your question until just now. As written now, the question is altogether different than when I first answered it. The mirror you describe is not in the spec, actually, as it is instead a rather dangerous and ugly hack known as a hybrid-MBR partition format. This question makes a lot more sense now - it's not ...


8

This is done via an authorization manager called polkit: polkit provides an authorization API intended to be used by privileged programs (“MECHANISMS”) offering service to unprivileged programs (“SUBJECTS”) often through some form of inter-process communication mechanism. With systemd and polkit users with non-remote session can issue power ...


7

On a Linux system, when changing the ownership of a symbolic link using chown, by default it changes the target of the symbolic link (ie, whatever the symbolic link is pointing to). If you'd like to change ownership of the link itself, you need to use the -h option to chown: -h, --no-dereference affect each symbolic link instead of any referenced ...


6

Most init systems probably won't expect this situation so they won't be prepared to first assemble LVM, then MD, then LVM again. If you put LVM below MD you have to be very careful. MD is supposed to be used with physical disks, but with LVs as RAID members you could easily end up with two members sharing the same disks. That is if using MD as a standalone ...


5

You can get a list of these interfaces on most systems from the following: ls -A /sys/class/net But beware of parsing the output from ls in your script. Edit To get a total number of network interfaces pipe the output of this command into wc as recommended in Nikolay's comment as in: ls -A /sys/class/net | wc -l


5

It shouldn't be possible. swapon system call requires readpage and bmap (indirectly) calls being implemented by filesystem: http://lxr.free-electrons.com/source/mm/swapfile.c?v=4.0#L2412 if (!mapping->a_ops->readpage) { error = -EINVAL; goto bad_swap; } But none of them are implemented by tmpfs, such an entry is missing from ...


5

Yes, there can be. If the system is I/O bound and CPU bound, -j2 will get more CPU being used while the other process is doing disk I/O. However, increasing the number of processes requesting from the disk could make it slower due to contention for disk head movement. As Stephen Kitt said, test it. time make clean all time make -j 2 clean all time make -j ...


5

I'm not sure why you would want to do that. If you're concerned about security, if someone discovers your password on 1 July, they'll know it on 31 July or 15 September... To answer your question, if you want to ensure that the password update is done either at a scheduled time or when the system restarts, you want to install anacron. It can do periodic ...


5

You can use the DEBUG trap to do this. In this trap, $BASH_COMMAND contains the command last executed. trap 'echo "you tried to call the command [$BASH_COMMAND]"' DEBUG Note that, if you are executing commands as part of your prompt or $PROMPT_COMMAND, the trap will run on these as well. You can add checks to see if $BASH_COMMAND is the same as ...


5

Don't allow USB access. Truth is that if someone has physical access to the machine, there's not a lot you can do. In this narrow case your best bet is to disable booting to USB and lock the BIOS (or whatever EFI setup utility is being used) with a password. It's a bit like putting a pad lock on a garage door, there are ways around it, but it's an easy ...


4

{ nl -s\; -w1 -ba | sort -t\; -k2,2 | sed -e:n -e'h;$!N' \ -e's/^\([^;]*\(;[^;]*;\).*\)\n[^;]*\2/\1;/;tn' \ -ex -e:N \ -e's/;/;/6p;tD' \ -e's|$|;N/A|;tN'\ -e:D -ex -eD | sort -t\; -nk1,1 | cut -d\; -f2-; } <in >out So there's a giant pipeline. It works ...


4

On Debian, reboots are logged. From man last: Last searches back through the file /var/log/wtmp (or the file desig- nated by the -f flag) and displays a list of all users logged in (and out) since that file was created. ... The pseudo user reboot logs in each time the system is rebooted. Thus last reboot will show a log of all reboots since the log ...


4

This is handled by anacron, which runs the default cron.daily etc. jobs on Fedora. If this is a root job, you can either add it to the /etc/cron.daily or to /etc/anacrontab.


4

This answer checks the list of all attached block devices and iterates over them with udevadmin to check their respective ID_BUS. You can see all attached block devices in /sys/block. Here is the bash script from the linked answer that should let you know if it is a USB storage device: for device in /sys/block/* do if udevadm info --query=property ...


4

You need to remove the leading $ (and while we're at it, quote $RADIOOUT and avoid its being interpreted as an option to file if it starts with -): EXTENSION=$(file -- "$RADIOOUT")


4

Linux is derived from UNIX so you do it exactly in the same way: ./getall.tcl xcm_in.txt > xcm_out.txt getall.tcl is the command you're calling (apparently a Tcl script) xcm_in.txt is the file passed as argument to the command xcm_out.txt is the file to which the command's stdout is redirected


4

If you're only checking for VirtualBox and don't need to cater for all hypervisors, there's a quick and dirty way - check for the presence of VirtualBox devices. lshw | grep VirtualBox lspci | grep VirtualBox I'm not sure if you'll have either or both of lshw and lspci but you can always install them as part of your custom installation (or, check the ...


4

When running sudo ls > /root/out.txt only the ls part of the command is being run with elevated privileges. Because of this the redirection part of your command does not have the permissions needed to the location you want. Instead you can use tee prefixed with sudo like so: ls | sudo tee /root/out.txt


4

You have an NTFS filesystem. In this case you cannot safely fix the problem on anything except a Windows machine. (The Linux code is good, but I cannot recommend you trust it to fix a foreign filesystem.) Take the disk to your Windows system and run CHKDSK /F Q:, or whatever drive letter it's been assigned. Then try deleting the file. If that fails you're ...


4

This is impossible because it's the Linux kernel that creates and manages the RAM disk. Responding to a later amendment to your question, asking how to reserve a chunk of memory that the OS cannot access. The OS manages all your access to the hardware. That is - by definition - part of what it's there for. So, no, it's not possible to reserve a chunk of ...


4

Google Compute Engine allows you to provision a Linux VM in your chosen region which you can then ssh into with root privileges. It's cheap and you can get $300 worth of usage as a free trial.


4

To disable the writing of access times, you need to mount the filesystem(s) in question with the noatime option. To mount an already mounted filesystem with the noatime option, do the following: mount /home -o remount,noatime To make the change permanent, update your /etc/fstab and add noatime to the options field. For example. Before: ...


4

There is really only one answer to this: full disk encryption. The way full disk encryption is usually done with Linux, your /boot partition is not encrypted and contains the kernel and initramfs — just enough functionality to start a minimal environment that prompts you for the passphrase to decrypt the root filesystem and get access to everything else. ...


4

You should be fine with just 2 or 4 Gb of swap size, or none at all (since you don't plan hibernating). An often-quoted rule of thumb says that the swap partition should be twice the size of the RAM. This rule made sense on older systems to cope with the limited amount of RAM; nowadays your system, unless on heavy load, won't swap at all. It mostly depends ...


3

I would debootstrap a base system to another directory. debootstrap --variant=minbase --arch=amd64 jessie /tmp/bootstrap http://ftp.us.debian.org/debian/ Then copy all files from /tmp/bootstrap/bin to /bin keeping the permissions. cp -a /tmp/bootstrap/bin/* /bin/ Now many (and the basic ones) of your files in /bin should be ok and you should be able to ...


3

There is the prips utility which generates an IP list from a range or CIDR. Useful for work with large ranges: $ prips 10.0.0.20 10.0.0.23 10.0.0.20 10.0.0.21 10.0.0.22 10.0.0.23 $ prips 10.0.0.0/23 10.0.0.0 10.0.0.1 10.0.0.2 <...> 10.0.1.254 10.0.1.255


3

You can use output of the /proc/ioports: $ cat /proc/ioports 0000-0cf7 : PCI Bus 0000:00 0000-001f : dma1 0020-0021 : pic1 0040-0043 : timer0 0050-0053 : timer1 0060-0060 : keyboard 0064-0064 : keyboard 0070-0077 : rtc0 0080-008f : dma page reg 00a0-00a1 : pic2 00c0-00df : dma2 00f0-00ff : fpu ... And cat ...


3

find <path>/. -type f -size 1033c ! -perm -0001 -ls


3

You're executing the command sudo su - USER2; whoami; pwd on the remote host. Let's decompose that: Commands separated by a semicolon are executed in sequence. Thus the command sudo su - USER2 is executed first; then, when it finishes, whoami is executed, and finally pwd is executed. The command sudo su - USER2 starts a login shell as user USER2. This ...



Only top voted, non community-wiki answers of a minimum length are eligible