date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,673,331,131,000
What sensors I can monitor on my AMD Threadripper 1950x on an ASRock x399 Taichi mobo under Linux. It was announced last year that temperature monitoring was working for Ryzen processors and that was supposedly included in the 4.15 kernel, according to this:https://www.phoronix.com/scan.php?page=news_item&px=AMD-Zen-T...
[deleted answer by OP:] I would still like to know: what exactly is making nct6775 available now? There are a lot of attempts at answering the general question in the following link. Unfortunately none of them are comprehensive, so I will try to improve on them. Linux: How to find the device driver used for a devi...
Ryzen/Threadripper temperature sensors: Which senors are related to which kernel modules and how to enable them
1,673,331,131,000
I get the message: thermald: Unsupported cpu model, use thermal-conf.xml file or run with --ignore-cpuid-check sensors-detect suggests coretemp and w83627hf which are installed and in /etc/module. Try If I run sudo thermald --no-daemon --ignore-cpuid-check | tee thermald.log, I get: NO RAPL sysfs present Polling mo...
If using systemd Edit /lib/systemd/system/thermald.service by running sudo systemctl edit --full thermald.service Add the option at the end of ExecStart: [Unit] Description=Thermal Daemon Service [Service] Type=dbus SuccessExitStatus=1 BusName=org.freedesktop.thermald ExecStart=/usr/sbin/thermald --no-daemon --dbus-...
How to run thermald with option --ignore-cpuid-check
1,673,331,131,000
I would like to cut 150.8 from this string temp1: +150.8°F (crit = +197.6°F). Here is my script for logging temperatures with the command sensors: #!/bin/bash now=$(date +"%m_%d_%Y") # get current date now_excel=$(date +"%D %H:%M") # get current date & time in excel format file_dir="/var/www/html/logs"...
Using sed Here is one way: $ sensors -Af | sed -n '2{s/°.*//; s/[^+-]*//; p; q}' +105.8 Or, using the same command inside command substitution to capture its output in a variable: temp=$(sensors -Af | sed -n '2{s/°.*//; s/[^+-]*//; p; q}') s/°.*// removes the first occurrence of the degree symbol, °, and everything ...
Cut string from command output
1,673,331,131,000
For example: Where does the lshw - list hardware program read the info out? (I mean on a software level, that there are probably some ROM chips here and there is of course the case) Basically everything, (the user could potentially want to know) about the machine and system internals, is provided to the user by the ke...
On x86 hardware, it gets a lot of its information from DMI, an API to get information from the BIOS. More details at github : lshw
Where does system information come from
1,673,331,131,000
I was wondering how to reformat terminal output for logging information. More specifically I would like to reformat the output of the sensors command from the lm-sensors package and write it to a file. The output looks something like this: acpitz-virtual-0 Adapter: Virtual device temp1: +61.0°C (crit = +99.0°...
I got the same problem and implemented a solution: Using sed to parse the piped output of sensors with regular expressions the result is appended to the log file. The date is written as UNIX timestamp to file and formated to stdout. To suppress the line break the echo -n "$(date +"%H:%M:%S") command is used. Next the...
Personalize sensor's output and save it to file
1,673,331,131,000
I use Debian linux squeeze x64 now on gigabyte 970a-DS3. I installed this OS on motherboard which burned (from asus). And I've changed my motherboard to that gigabyte. After running back into linux, it shows I have only 13,9 °C temperatures and is it only 1 sensor (instead of about 3 or 4 sensors), which it has detec...
Follow the specification your MB is based on the iTE IT8728 chip which is not supported by lm-sensors. Sorry.
Sensors showing bad values
1,673,331,131,000
I have a pretty badly ventilated computer whose temperature reaches 100º C in some occasions. The poor thing can't be ventilated any better ("put a bigger fan" is not a suitable solution). When the CPU reaches 100º C, the machine stops "violently" (just shuts down). That machine is running Ubuntu 10.10 with lm-sensors...
It depends on what is the output of sensors. If yours is something like mine: % sensors k10temp-pci-00c3 Adapter: PCI adapter temp1: +44.0°C (high = +70.0°C) then you can use the following script, adapting it accordingly. Besides TEMP_STOP and TEMP_START, you should change the regular expression that filters ...
Lm-Sensors: Run specific commands when temperature goes above/below limits
1,345,663,008,000
I am trying to get my laptop to communicate with my SRF02 sensor, which is using a USB-I2C interface. My laptop is running Debian Jessie. Problem: When I run sudo i2cdetect -y 0 I see no devices at all. This is the same for port 1 but beyond that lots of devices display at random places (eg port 4 shows a nearly full ...
The relevant lines from dmesg are: [ 518.172735] usb 1-3: new full-speed USB device number 4 using xhci_hcd [ 518.306677] usb 1-3: New USB device found, idVendor=0403, idProduct=6001 [ 518.306686] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 518.306689] usb 1-3: Product: FT232R USB UART [ 5...
Enabling I2C on Debian - i2cdetect doesn't show device
1,345,663,008,000
I have the files in folders that begin with 28-. They are one wire bus sensors to measure the temperature. The Raspberry recognize them via its SPI interface; every probe has its ID (something beginning with 28-), and RB creates a tree for every sensor named as the probe's ID, like ls /sys/bus/w1/devices/w1_bus_master...
Using only jq (twice) and a shell loop: for pathname in /sys/bus/w1/devices/w1_bus_master1/28-*/; do jq -n \ --arg ID "$(basename "$pathname")" \ --arg temp "$(cat "$pathname"/temperature)" \ '{ ID: $ID, temp: $temp }' done | jq -s '. | map( .temp = (.temp | tonumber / 1000) )' The loop it...
Get content of files with same name in subfolders to obtain a JSON array
1,345,663,008,000
TL;DR: The kernel module sht3x (https://www.kernel.org/doc/html/latest/hwmon/sht3x.html) seems to be missing in a standard debian installation. I need it in order to read an external sensor. How can I install this kernel module? The whole story I try to connect an SHT31 temperature/humidity sensor to my Debian noteboo...
I’m assuming you’re running Debian 10, but the instructions for later versions are similar. The module you’re after is supported by the kernel version used in Debian 10, but it is not enabled; let’s fix that. Install the kernel source for the default version in your release: sudo apt install linux-source Extract it...
hwmon: add missing kernel module
1,345,663,008,000
How to check harddisk maximum temperature throughout its lifespan in Linux? In the Windows software Hard Disk Sentinel, we can check the Maximum Temperature (during entire lifespan): The software displays the current hard disk temperature and logs maximum and average HDD temperatures. This value is available even if...
smartctl will show you the min/max temperature of a disk: tempminmax - Raw Attribute is the disk temperature in Celsius. Info about Min/Max temperature is printed if available. This is the default for Attributes 190 and 194. The recording interval (lifetime, last power cycle, last soft reset) of the min/max value...
How to check harddisk maximum temperature throughout lifespan?
1,345,663,008,000
Trying to get hwmon working more fully on a system with an ASRock Z370M Pro4. The coretemp and drivetemp drivers seem to be fine. However, this board also has a Nuvoton NCT6683 chip for the usual voltage, fan speed, and temperature monitoring. This is what sensors-detect comes up with, and when the module loads, it lo...
Well, it turns out all I had to do was load the module with force=1. I dismissed the possibility because it's supposed to be for "unknown vendors" and ASRock is one of the known vendors. Plus, it appeared to recognize the chip. But reading the source code, I have to conclude this one doesn't have ASRock's customer ID ...
hwmon driver working, yet not working
1,345,663,008,000
Yes, I know that is an old chip. Running a sensors-detect with all the optional tests yields nothing. My sensors refuse to read the temperature of the CPU. I know there is a working temperature sensor in there because I can see the correct temperature in the BIOS. Does anyone know which kernel module I have to enable?...
k10temp is the CPU temperature sensor. With older AMD CPUs you get only one value, which isn't even "real" temperature: For CPUs older than Family 17h, there is one temperature measurement value, available as temp1_input in sysfs. It is measured in degrees Celsius with a resolution of 1/8th degree. Please note that i...
How to get sensors-detect to detect an AMD Phenom II temtperature sensor
1,345,663,008,000
When I run screenfetch my cpu temperature is always shown higher than what xfce4-sensors show. note: xfce4-sensors and lm-sensors output the same temperature so I omitted lm-sensors. Here is a screenshot of screenfetch and xfce4-sensors at exactly the same time. Can anyone explain to me which temperature is the correc...
I think discrepancy could be explained by the three points below: First, screenfetch shows only one value, this means it's an average value. Second, keep in mind there are different sensors in a system (always talking about CPU): one or more sensors on the motherboard "close" the CPU, (usually) one sensor for the p...
Why is the cpu temperature different on screenfetch and xfce4-sensors and lm-sensors
1,345,663,008,000
I have a Samsung NP900X3E laptop and I would like to control the fans as one of them is making weird noise. I'm running Ubuntu 14.04.4 LTS with "Linux laptop 3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux" sensors reports: root@laptop:/# sensors acpitz-virtual-0 Adapter: ...
Based on your output of sensors, it appears that lm_sensors does not detect any fan speed reading. You should try running sensors-detect and answer yes to all questions to hopefully detect one that wasn't previously configured. If not, then it simply won't be possible to control those fans. The BIOS controls the fans...
Control fans of Samsung NP900X3E
1,345,663,008,000
I'm running Debian Testing on a Dell Latitude 7480. I've been having a lot of freezing issues, and I have finally narrowed it down to an overheating problem. On battery, I can work for 1hr+ with no problem, and sometimes the system will freeze: mouse stops moving, the backlight of the keyboard doesn't power off, I can...
The solution in this case was to set modify /etc/default/grub so as to contain this line: GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi=!Windows 2020". The acpi_osi parameter tells the kernel to treat ACPI events as if they were happening on the value OS.
Debian Testing freezing because of overheating, fan sensors give confusing info
1,345,663,008,000
I can't load the www.lm-sensors.org webpage. I'm looking for documentation/information on lm-sensors to see if it is easy or hard to update it to detect Temper-USB thermometers. It would be nice if we could get it to detect Temper-USB thermometers so we could chart it using PSensor. Is the project dead?
The site is down but the mailing list is active; http://comments.gmane.org/gmane.linux.drivers.sensors/38361
Is the lm-sensors project dead? www.lm-sensors.org doesn't load [closed]
1,345,663,008,000
How reliable is the program lm-sensors in Linux? When I run watch sensors, I see large skips of temperature, as high as 10 degrees Celsius within the refresh interval of 2 seconds. The two readings below show this, with two screenshots taken 2 seconds apart, with Core 1 jumping 8 degrees down between those. Reading 1:...
It's totally expected for new AMD and Intel CPUs due to their heat density due to very small transistors where billions of them are crammed into very small space. If you don't want to see such high temperatures or temperature fluctuations, disable turbo boost: echo 0 | sudo tee /sys/devices/system/cpu/cpufreq/boost I...
How reliable is the program `lm-sensors` in Linux?
1,345,663,008,000
The core number is 0,4,8,.....39 in the sensors command. Why not 0,1,2,3,4.....? foo@foo-linux:~$ sensors coretemp-isa-0000 Adapter: ISA adapter Package id 0: +73.0°C (high = +80.0°C, crit = +100.0°C) Core 0: +46.0°C (high = +80.0°C, crit = +100.0°C) Core 4: +50.0°C (high = +80.0°C, crit = +100.0°C) ...
The core number comes from the cpu_core_id variable in the struct temp_data in the coretemp driver module. In its source code, cpu_core_id is described like this: * @cpu_core_id: The CPU Core from which temperature values should be read * This value is passed as "id" field to rdmsr/wrmsr functions. The rdmsr an...
Why aren't the CPU core numbers in sensors output consecutive?
1,345,663,008,000
This is the output from sensors on my machine, Ryzen 5 3600X on a Biostar B450MH: amdgpu-pci-0a00 Adapter: PCI adapter vddgfx: 725.00 mV fan1: 0 RPM (min = 0 RPM, max = 3630 RPM) edge: +45.0°C (crit = +100.0°C, hyst = -273.1°C) (emerg = +105.0°C) junction: +45.0°C...
The k10temp driver only reports what it's capable of reporting and individual cores temperatures and wattage are not currently available/implemented. Patches are welcome (but that doesn't mean they will be merged). Shouldn't k10temp be reporting individual core temperatures like coretemp for Intel CPUs? No. "Should"...
lm_sensors not reporting individual core temps on AM4/B450
1,345,663,008,000
I'm trying to retrieve only the temp of the 4 cores, to display them into my terminal (I needed them separated). My original output is : (OC) √ ~ $ sensors ~ 9:24:24 coretemp-isa-0000 Adapter: ISA adapter Package id 0: +68.0°C ...
Try this, sensors | awk -F '(' '/^Core/{gsub("[[:space:]]+"," "); printf "%s\t", $1}' ( as a field delimiter /^Core/ to extract lines only which starts with 'Core' gsub("[[:space:]]+"," "); to replace multiple successive spaces to single space as per expected result "%s\t", to print all results in same line with tab...
Get only temp core from sensors
1,345,663,008,000
I installed the lm-sensors on my Ubuntu platform in order to check the temperature of my processors and possibly some other info. When I run the command, I see the following: alexis~$ sensors power_meter-acpi-0 Adapter: ACPI interface power1: 4.29 MW (interval = 1.00 s) coretemp-isa-0000 Adapter: ISA adapter...
The scaling function used here uses SI prefixes, where “M” corresponds to 106, so “4.29 MW” means “4.29 megawatts” (and your system is presumably reporting incorrect values, or sensors is mis-interpreting them).
What does "power1: 4.29 MW (interval = 1.00 s)" mean? That is, what is the "MW" unit?
1,345,663,008,000
I am trying to boot AntiX LiveCD on my old Toshiba A200 laptop with 2 GB of RAM. But when I accidentally launched the "sensors" in the terminal, I saw that the CPU temperature was 70°C! I turned off the laptop and turned it on again, and the fan revved up to the maximum. It turns out that antiX stops the fan? What sho...
Fan control, especially for old hardware like yours, is a quite obscure matter on Linux; there are multiple variables to take into account, e.g.: kernel version; BIOS version; BIOS settings; and their combination; personally I have never had a such problem, rather the opposite: fan running constantly at 100% with no...
AntiX linux disable laptop fan
1,345,663,008,000
I assembled a brand new Ryzen-based workstation. The temperature sensors returned by sensors seems to be working fine, but those of the CPU do not specify low, crit, and high thresholds. > sensors nvme-pci-0100 Adapter: PCI adapter Composite: +36.9°C (low = -20.1°C, high = +74.8°C) (crit = ...
lm-sensors comes with the only configuration file /etc/sensors3.conf which has some definitions (allowed minimums and maximums) for certain chips. Since lm-sensors has no way of knowing which exact AMD K10 compatible CPU you're running, they cannot add it to the configuration which works for everyone. Probably you can...
No crit high low returned by sensors - is this normal?
1,345,663,008,000
I have 2 scripts: track_temps.sh while true do echo -n "$(date +"%H:%M:%S"): " sensors | grep Tdie # Sleeping for X seconds sleep 1 done track_mhz.sh while true do # Printing the time and all temperatures to stdout echo -n "$(date +"%H:%M:%S"): " cat /proc/cpuinfo | grep "MH" | sort -...
I would try while true do echo -n "$(date +"%H:%M:%S"): " echo -n "$(sensors | grep Tdie) " awk '$2 == "MHz" { if (c< $4) c=$4;} END {printf "cpu MHz %s\n",c}' /proc/cpuinfo sleep 1 done on my box cpu frequency change from 998 to 1200 MHz, I am not sure sort -r will behave as expected. (string "90...
How to merge the output of these 2 tracking scripts
1,345,663,008,000
Not sure if I should be concerned. The temp is not considered high. But it is much higher than anything else. Also if I play a video the GPU temp is 85C. And the fan shows 0 rpm. Never noticed that before. Not sure if that is a problem? Putting my hand in there I could feel the air from the fan on the GPU on a c...
You said you've checked that the fan on the GPU actually works, so the "0 RPM" is either a sensor fault or the driver doesn't actually know how to read the fan speed from this particular GPU model. Or perhaps the GPU manufacturer has chosen to use a 2-wire fan in this model, so there'll be no easy way to monitor the f...
Running sensors I get gpu temp of 72C and fan 0 rpm... bad?
1,372,614,114,000
I need to manually edit /etc/shadow to change the root password inside of a virtual machine image. Is there a command-line tool that takes a password and generates an /etc/shadow compatible password hash on standard out?
You can use following commands for the same: Method 1 (md5, sha256, sha512) openssl passwd -6 -salt xyz yourpass Note: passing -1 will generate an MD5 password, -5 a SHA256 and -6 SHA512 (recommended) Method 2 (md5, sha256, sha512) mkpasswd --method=SHA-512 --stdin The option --method accepts md5, sha-256 and sha-5...
Manually generate password for /etc/shadow
1,372,614,114,000
The second field in the Linux /etc/shadow file represents a password. However, what we have seen is that: Some of the password fields may have a single exclamation <account>:!:..... Some of the password fields may have a double exclamation <account>:!!:..... Some of the password fields may have an asterisk sign <...
Both "!" and "!!" being present in the password field mean it is not possible to login to the account using a password. As can be read from the documentation of RHEL-4, the "!!" in the shadow-password field means the account of a user has been created, but has not yet been given a password. The documentation states (p...
Difference between ! vs !! vs * in /etc/shadow
1,372,614,114,000
When did Unix move away from storing clear text passwords in passwd? Also, when was the shadow file introduced?
For the early history of Unix password storage, read Robert Morris and Ken Thompson's Password Security: A Case History. They explain why and how early Unix systems acquired most the features that are still seen today as the important features of password storage (but done better). The first Unix systems stored passw...
When did Unix stop storing passwords in clear text?
1,372,614,114,000
In /etc/shadow file there are encrypted password. Encrypted password is no longer crypt(3) or md5 "type 1" format. (according to this previous answer) Now I have a $6$somesalt$someveryverylongencryptedpasswd as entry. I can no longer use openssl passwd -1 -salt salt hello-world $1$salt$pJUW3ztI6C1N/anHwD6MB0 to...
Python: python -c 'import crypt; print crypt.crypt("password", "$6$saltsalt$")' (for python 3 and greater it will be print(crypt.crypt(..., ...))) Perl: perl -e 'print crypt("password","\$6\$saltsalt\$") . "\n"'
/etc/shadow : how to generate $6$ 's encrypted password? [duplicate]
1,372,614,114,000
Based on /etc/shadow(5) documentation on the second (password) field: encrypted password If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means). My question ...
You are looking for passwd -l user. From man passwd: Options: [...] -l, --lock lock the password of the named account. This option disables a password by changing it to a value which matches no possible encrypted value (it adds a '!' at the beginning of the password).
Disable password on linux user with command
1,372,614,114,000
If I cat /etc/shadow I can get the encrypted passwords of root and my user. These passwords are the same (I know, bad security) for each account, but in /etc/shadow they show up as being different encrypted strings. Why? Are different algorithms used for each?
Separate users means a separate User ID, and therefore separate hashes will be involved with the algorithm. Even a user with the same name, same password, and created at the same time will (with almost certain probability) end up with a different hash. There are other factors that help create the encryption. If you wa...
Root and my password are the same
1,372,614,114,000
I am noticing a lot of weird files appearing in my router and on my various filesystems. Files in weird places or files that have to do with security with a - sign after them. If I do ls -l /etc/shadow*, this is what I see. -rw-r----- 1 root shadow 1163 Aug 9 15:48 shadow -rw------- 1 root root 1163 Aug 8 21:11 sh...
These files are perfectly normal. From the shadow(5) manual page: /etc/shadow- Backup file for /etc/shadow. You may similarly see /etc/passwd-, /etc/group- and /etc/gshadow-. These backup files are created all the tools in the Linux user database utility suite (shadow): both interactive tools such as vipw and auto...
Is it normal to have a file called "shadow-" in the /etc directory?
1,372,614,114,000
I found some entries in a shadow file whose meaning I don't understand. user:UP::::::: user1:NP::::::: What does UP and NP mean? In addition to those 2, the same shadow file has the normal hashed entry and the LK that indicates a locked account. The machine is a Solaris 10 VM.
NP in the password field of /etc/shadow indicates that that the account cannot be logged into with a password but can be logged into with other authentication methods, such as su down from root or cron jobs. NP means that password authentication will always fail, but other login methods may succeed. You can set an acc...
What's the meaning of NP and UP in the password field of the shadow file
1,372,614,114,000
Normally only root can access /etc/shadow. But programs like su and sudo can check passwords without running as root. So the question is: Why can these programs access /etc/shadow without privileges? I tried to access it without privileges via python with the spwd module, but I didn't get access (like expected). Which...
why have programs like su access to /etc/shadow Because programs like su and passwd have set SetUID. You can check by using : [root@tpserver tmp]# ls -l /usr/bin/passwd -r-s--x--x 1 root root 21200 Aug 22 2013 /usr/bin/passwd When you look around in your file permission you will see "s". If anybody is trying to ...
why have programs like su access to /etc/shadow
1,372,614,114,000
I'm puzzled by the hash (ASCII) code stored under Linux (Ubuntu) /etc/shadow. Taking a hypothetical case, let password be 'test', salt be 'Zem197T4'. By running following command, $ mkpasswd -m SHA-512 test Zem197T4 A long series of ASCII characters are generated (This is actually how Linux store in the /etc/shadow) ...
On Ubuntu/Debian mkpasswd is part of the package whois and implemented in mkpasswd.c which as actually just a sophisticated wrapper around the crypt() function in glibc declared in unistd.h. crypt() takes two arguments password and salt. Password is "test" in this case, salt is prepended by "$6$" for the SHA-512 hash ...
SHA512 salted hash from mkpasswd doesn't match an online version
1,372,614,114,000
man 5 shadow says this about the 2nd field: encrypted password Is that true nowadays? I think it should say "hashed password". Am I correct?
No, the shadow file does not contain encrypted passwords, not on any Unix variant that I've seen. That would require an encryption key somewhere — where would it be? Even the original version of the crypt function was in fact a hash function. It operated by using the password as a key for a variant of DES. The output ...
Does the shadow file have encrypted passwords?
1,372,614,114,000
I want to know my /etc/shadow password hash if its SHA or MD or something else. From what I read, it is related to the $ sign, but I don't have any dollar signs. Im using Ubuntu 16 Example: user:0.7QYSH8yshtus8d:18233:0:99999:7:::
The shadow(5) manual on Ubuntu refers to the crypt(3) manual. The crypt(3) manual says that the default password encryption algorithm is DES. It goes on to say that the glibc2 library function also supports MD5 and at least SHA-256 and SHA-512, but that an entry in /etc/shadow for a password encrypted by one of these...
How to know if password in /etc/shadow is hashed with SHA or MD?
1,372,614,114,000
The file /etc/shadow has a couple date fields that are expressed as the number of days since Jan 1, 1970. Is there an easy way using to get a list of users and the calendar date of the last password change, and the expiration? Ref: man shadow(5)
There was an answer that got deleted, while somewhat wrong, did lead me in the correct direction. Using gawk's strftime combined with some arithmetic gives me what I wanted. cat shadow | gawk -F: '{ print $1 ":" strftime("%Y%m%d",86400*$3) ":" strftime("%Y%m%d",86400*$4)}' root:20120304:19691231 daemon:20100203:19691...
Extract dates from /etc/shadow
1,372,614,114,000
Consider this Shadow string $y$j9T$PaFEMV0mbpeadmHDv0Lp31$G/LliR3MqgdjEBcFC1E.s/3vlRofsZ0Wn5JyZHXAol5 There are 4 parts id : y (yescrypt) param : j9T salt : PaFEMV0mbpeadmHDv0Lp31 hash : G/LliR3MqgdjEBcFC1E.s/3vlRofsZ0Wn5JyZHXAol5 Q: What does j9T in param field mean? Are there other options in this field? Where c...
Disclaimer Below are my own findings and the way I interpreted them without having an expert understanding of cryptography and the concepts involved. Signatures Notably, as the yescrypt CHANGES file on the OpenWall GitHub states about the Changes made between 0.8.1 (2015/10/25) and 1.0.0 (2018/03/09), yescrypt has two...
What does j9T mean in yescrypt (from /etc/shadow)?
1,372,614,114,000
I am asking, because I generated a live CD using the hash from an existing /etc/shadow, assuming I will then be able to login with the corresponding password, but apparently login fails.
It's possible if the target system uses shadow passwords, and /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and the target system doesn't hash /etc/shadow, and the target system has the same usernames as the source system, and the UIDs on the target system are the same as the UIDs on the sou...
When I copy /etc/shadow to another system, is it possible to login with the according passwords?
1,372,614,114,000
Are formats of files /etc/shadow and /etc/passwd same on all unix and unix-like systems same or are there significant differences? I mean syntax of files, not file location or name
As far as I know, all unix variants have an /etc/passwd file with the traditional layout, for the sake of applications that read the file directly. Each line in the file contains colon-separated records which correspond to struct passwd fields: user name (login) encrypted password (if present) user id (number, in dec...
/etc/shadow and /etc/passwd format compatibility
1,372,614,114,000
Real dumb question, but suppose a computer with Linux does not have an encrypted hard drive. If I generated a hash with "openssl passwd", couldn't I just run a live version of Ubuntu and add my hash to the /etc/shadow file? Or is /etc/shadow encrypted even if the hard drive isn't?
What prevents me from just editing the /etc/shadow file in unencrypted systems? Nothing, there is no specific protection for /etc/shadow. Some systems might have tampering detection, so the system administrator would know that /etc/shadow was changed (unless you also overrode the tampering detection, typically by up...
What prevents me from just editing the /etc/shadow file in unencrypted systems? [duplicate]
1,372,614,114,000
I would like to know how the password verification in Linux works. I know that the passwords are stored as a hash in /etc/shadow file and user information is in /etc/passwd file. My understanding is this: Selecting what user you want to login as decides what user name the system should check. When you enter th...
Yes. You're correct. Each steps can be split in minor tasks as well, but you describe the overall algorithm. Follow a couple of articles describing in details the login process. [1] [2] Note that this is only about the plain password, not mentioning PAM system. [3]
How does Linux verify the login password?
1,372,614,114,000
http://www.aychedee.com/2012/03/14/etc_shadow-password-hash-formats/ From the above article I can see the password can be encrypt in abot 6 different ways to genereate the hash in the format of $1$ ... However, when I read the shadow file of my machine, I get something like this root:l2tdfsoZQxobQ:15743:0:99999:7::: ...
If the hashing algorithm isn't listed in the password field, it's usually because it's in traditional DES-based crypt form. The hash you've provided even looks like a crypt hash. Examples of what other DES hashes look like: [root@xxx601 ~]# openssl passwd -crypt myPass 7BQrU5yVqiGqU [root@xxx601 ~]# openssl passwd -cr...
/etc/shadow encryption method
1,372,614,114,000
I know that on Linux (at least debian) every password are hashed and stored in /etc/shadow. However thanks to the libpam-cracklib you can add some rules on passwords. For instance in /etc/pam.d/common-password you can set Difok which is a parameter that indicate the number of letter that can be the same between an old...
When you ask a PAM module to change a password (or participate in changing a password), the module can retrieve both the new password and the old, as given by the user: as Christopher points out, passwd asks for the old password as well as the new (unless you’re running it as root and changing another user’s password)...
How Linux can compare old and new password?
1,372,614,114,000
I am trying to change my password as a non root user : passwd The data is updated in /etc/shadow, but checking the permission i get: ---------- 1 root root 6076 Jan 27 17:14 /etc/shadow cat /etc/shadow cat: /etc/shadow: Permission denied Clearly there were no permissions on the file for anyone, even then the pass...
The passwd utility is installed setuid, which means that when it runs, it runs as the user that owns the file, not as the user that called it. In this case, passwd belongs to root, so the setuid bit causes the program to run with root privileges. It is therefore able to make changes to the passwd and shadow files. If ...
How passwd command from non-root account succeeds
1,372,614,114,000
We have an automated sync-routine that uses useradd to create new users on a Ubuntu 10.04 machine. The application launching the routine provided both username and CRYPT-encrypted password. However, since we changed how passwords are handled in order to include LDAP support, passwords now don't have to be CRYPT but ca...
Why not authenticate those users for which you only have an unsalted SHA-1 hash of their password by another means than /etc/shadow. Using PAM, you can have as many authentication modules as you want and stack them as you want. You can keep pam_unix.so for some users and use pam_ldap.so for the rest.
Can linux use a mix of SHA-1 and CRYPT passwords?
1,372,614,114,000
I want to get the password hash of the sys user in Debian (but the password is preferred). I heard that all password hashes are stored in the /etc/shadow file, but there isn't a password hash for the sys user. How to get it? P.S. I have root access.
On a usual desktop installation, what you see in /etc/shadow is what you get, and the system users generally don't have passwords set. They're not used for interactive logins, so they don't need passwords. E.g. on the system I looked at, /etc/shadow has this line for sys: sys:*:19101:0:99999:7::: That * is where the ...
Where is the system's "sys" user's password hash stored in Debian?
1,372,614,114,000
It seems to me that /etc/shadow and /etc/passwd contain the same data. Why are there two files? Are they different?
Historically /etc/passwd had all of the user data, there was no shadow. However it was discovered that a dictionary attack could be done on the file, to discover passwords (if they are in the dictionary). Therefore it was decided to remove the passwords from /etc/passwd, the rest of the file remained, as it was used b...
What is the difference between /etc/shadow and /etc/passwd?
1,372,614,114,000
On a Debian 10 server, which started as Debian 7 and updated whenever new version came out, I accidentally found these three files: /etc/passwd.org, /etc/group.org, /etc/shadow.org The backup files /etc/passwd-, /etc/group-, /etc/shadow- and other *- files are present, as they should. For example, all passwd files are...
The .org files are remnants of an old base-passwd upgrade, which detected differences between the Debian default system accounts and those present on the system. When this happened, the upgrade would have offered to fix the files, keeping backups with .org suffixes. They can be deleted now.
/etc/passwd.org, /etc/group.org, /etc/shadow.org files
1,372,614,114,000
I was reading the BSI Security Guidelines (GERMAN), on NIS and it explicitly mentioned that one should prevent the entry +::0:0::: from occuring in the /etc/passwd file of the NIS server. From my research I have garnered, that the + would import the entire NIS list into the passwd file. The solution proposed by the g...
The entries like +::0:0::: can only work as intended if you have passwd: compat in your /etc/nsswitch.conf file. If you use passwd: files nis instead, this entry will not have its intended effect. At least according to nsswitch.conf(5) man page on my Debian 9 system, that does not seem like valid syntax anyway: it sho...
Why is +::0:0::: not supposed to be found in /etc/passwd?
1,372,614,114,000
/etc/shadow contains the username, but not the uid. Is there a specific reason, why a char * field was chosen over an int? For direct username->password check this might be quicker, but for relations to /etc/passwd a string-comparison on each user seems a little expensive. I'd like to know the rationale behind this d...
There could be multiple users with the same uid (but different name, home directory, shell, etc) in /etc/passwd. And that was current practice -- IIRC even today, there's a toor "alternate root" account on BSD. If the /etc/shadow passwords were indexed by uid instead of user name, then which /etc/passwd entry would ea...
Why does /etc/shadow uses user name instead of uid?
1,372,614,114,000
Having read this: https://stackoverflow.com/questions/11700690/how-do-i-completely-remove-root-password I was under the impression that a blank root password, as in modifying the /etc/shadow file for the root entry to be something like this: root::0:0:99999:7::: Should allow me to su to root without being prompted fo...
Since su is usually configured via pam_unix, it's oftentimes configured with the nullok_secure directive on Debian systems: $ grep -m1 pam_unix /etc/pam.d/system-auth auth sufficient pam_unix.so nullok_secure Changing that default to just nullok should enable password-less su usage.
Blank root password disabled in modern distros?
1,372,614,114,000
as my related question doesn't seem to get much love, here another one: What's the proper way to authenticate a user via username/password prompt in Linux nowadays? In principle, I suppose I would have to obtain username and password, read salt and hash of the corresponding user from /etc/shadow. I would then calculat...
You fear of an update of shadow-utils is IMO unwarranted. The routines described in that HOWTO are available on my Ubuntu 12.04 and Mint 17 systems without installing anything special. The structure to read /etc/shadow information in a C program can be found in /usr/include/shadow.h and with man 5 shadow and the func...
What's the correct way to authenticate a user without PAM?
1,372,614,114,000
I created a hard link for the shadow file. For removing the passwd of the user I opened the shadow file in vi editor and removed the encrypted passwd and then saved. The inode value of the shadow file was changed. Then I updated the passwd of the user and again the inode value of the shadow file changed. Why the inod...
The usual implementation of password changing involves hardlinking /etc/shadow to /etc/stmp (or some similar name; link() being atomic on local filesystems, this constitutes a kind of lock file mechanism), writing out a new one to a temporary file, then renaming the original /etc/shadow to /etc/shadow- or similar and ...
Why the inode value of shadow file changes?
1,372,614,114,000
In /etc/shadow, I have a line that begins: ubuntu:!$6$Pi4BKmX8$........................ Why is there a ! before the $6$ in the hash?
It means that the password is locked. Tools, such as usermod -L add a ! to the password to invalidate it. usermod -U removes the !. From man 5 shadow If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but...
Why is there a ! in the password hash?
1,372,614,114,000
On one of my machines it's root::somenumber[...]::: with somenumber[...] being the same as for my actual account (after what appears to be the encrypted passphrase) and the "logcheck" account (after :*:). On another machine it's root :!:somenumber[...]::: with somenumber[...] being the same for all accounts until the ...
From: man 5 shadow: A password field which starts with a exclamation mark means that the password is locked. The remaining characters on the line represent the password field before the password was locked. Without anything, it means you don't have any password for that account. This field may be empty...
What should be in the /etc/shadow file if I want my root account to be disabled?
1,433,520,021,000
When I look at /etc/shadow I see several entries that look like this: username:**___________::::::: What does the "**___________" mean? That is where I should see the password hash.
A password field that starts with * means the corresponding user is not allowed to login. This is generally used for system accounts, such as mysql, mail, apache, etc. However, if the entry is literally ending with :::::::, this means the corresponding user is a NIS / NIS+ account.
What does **___________ mean in /etc/shadow?
1,433,520,021,000
I'm playing with a rather old, heavily customized Linux installation (based on Debian etch, running on a Netgear ReadyNAS device). Recently I've switched from /etc/passwd to /etc/shadow via pwconv. Now I'd like to switch back due to authentication problems with the Apache server, because mod_auth_shadow is not install...
The pwconv command automagically backups the /etc/passwd in a file called /etc/passwd-. Try to restore this file and rename /etc/shadow to /etc/shadow-.
How do I switch from /etc/shadow back to /etc/passwd?
1,433,520,021,000
My understanding is that the last change date(in /etc/shadow) is the number of days since 01/01/1970 that the password was changed, but I'm seeing numbers like 19708 which translate to 17/12/2023 (future). How is it so?
Your understanding is correct, at least on Linux. And I've confirmed that my accounts show sane dates. Two possibilities come to mind: You—or a prior admin—used chage -d (or direct editing) to change the expire date. Possibly this was done to prevent password expiration, by making the last change date (and thus expir...
Unix last password change date
1,433,520,021,000
I have been told one of my Docker images has "Docker security issue CVE-2017-12424", says one of its package shadow version is "1:4.4-4.1". And I need to upgrade. But I can only see version 1:4.4-4.1 of my Debian packages: $ dpkg -l | grep 1:4.4-4.1 ii login 1:4.4-4.1 amd64 ...
From the package version numbers, it looks like Debian 9 ("stretch"), which is the oldstable version since 2019-07-06. Maybe it's time to consider updating your Docker image to use a newer stable version? CVE-2017-12424 appears to be about the /usr/sbin/newusers tool, which is in the passwd package. If you don't need ...
How to upgrade shadow package in Debian
1,433,520,021,000
I am looking for a sed command to change the line: userA:$6$lhkjhl$sdlfhlmLMHQSDFM374FGSDFkjfh/7mD/354dshkKHQSkljhsd.sdmfjlk57HJ/:95170:::::: to userA:$6$sLdkjf$576sdKUKJGKmlk565oiuljkljpi/9Fg/rst3587zet324etze.dsfgLIMLmdf/:34650::::::
instead: chpasswd -e <<< 'userA:yourencryptedpassword' If you were going to use sed - despite the risks: To set a password - no matter what it was before: sed -i.sedbackup 's/^\(userA:\)[^:]*\(:.*\)$/\1yournewpassword\2/' /etc/shadow To replace a specific password string: sed -i.sedbackup 's/^\(userA:\)youroldpasswo...
Change Shadow Password
1,433,520,021,000
PAM manages to check the user password, when called from unprivileged screen-lockers. E.g.: Password for GNU screen lockscreen command? https://github.com/google/xsecurelock I can't find any SUID-root binary in the screen package on Fedora 26, but the lockscreen command (Ctrla Ctrlx) still works. I can't see any the...
If you look at the binaries installed by pam, it includes unix_checkpwd. unix_chkpwd is a helper program for the pam_unix module that verifies the password of the current user. It also checks password and account expiration dates in shadow. It is not intended to be run directly from the command line and logs...
How is PAM checking the user password in unprivileged processes?
1,433,520,021,000
I'm running Bananian linux on my Banana Pro recently I changed some config settings but quit it with ctrl + c without finishing editing all the config settings. After restart I am unable to login with default login - "root", I get the error incorrect login every time I try. I tried checking my username in /etc/passwd...
Since you seem to have access to /etc/shadow as a privileged user (sudo?), do sudo passwd root If on the other hand, you are editing the filesystem in the MicroSD card in another machine, just edit out the root password in /etc/shadow. Delete the encrypted password field as in: root::14610:0:99999:7::: Then you wi...
Unable to recover lost login
1,433,520,021,000
I have a CentOS 7 image on my local machine that I want to allow login as root. This is going to be a system dedicated for testing. I initially tried using rescue mode and added kernel param "systemd.unit=emergency.target" but it says root login is locked. So I start /bin/bash instead. I see root in /etc/shadow is loc...
Most likely you modified the filesystem in an emergency shell or from a rescue disk. Your SELinux labels are probably wrong for /etc/shadow. Easiest fix is to touch /.autorelabel and reboot normally. It will relabel the filesystem and reboot.
CentOS 7 - how to login as root
1,433,520,021,000
After all these years of using Linux, I have never goofed up this badly. I should have known better, I honestly don't know what I was thinking. While trying to fix a small error message I was getting (this is irrelevant to my now much bigger issue), I found a post that said to "just run pacdiff and overwrite old files...
I have never used Manjaro, but the process that works for Arch Linux should be fine in your case too. You should be able boot off a Manjaro live USB, mount the root file system of your Manjaro installation, mount your existing /home directory and put the backup copy you have of shadow back to its place. Then you shoul...
Locked out: overwrote /etc/shadow and /etc/grub.d with pacnew
1,433,520,021,000
I was reading the shadow file structure explained here. I was wondering what happens if, perhaps for some type of error or wrong manual changes, the $id field representing the hashing algorithm is missing. The hash would be interpreted using a default system hashing algorithm? Or the account would be locked down for h...
If the has identifier is lost, the hash will be interpreted as coming from the DES crypt algorithm (the default). The real password won’t match, so the user will in effect be locked out from the account, but the account itself won’t be locked down — so for example root will be able to access it. It may be possible to ...
Encrypted password with no linked algorithm
1,433,520,021,000
I saw some abnormal thing after changing root password in linux. When I typed ls -al /etc/ | grep shadow after changing root password, the result is as below. -r-------- 1 root root 653 Mar 9 2018 gshadow -r-------- 1 root root 800 Jul 25 06:43 shadow -r-------- 1 root root 796 Jul 25 06:43 shadow- But som...
Yes, the passwd command first writes the modified contents of the /etc/shadow file in full to /etc/nshadow, runs fsync() to ensure the nshadow file is actually written to the disk, and then renames /etc/nshadow to /etc/shadow. This is done to eliminate the possibility of ever having an incomplete file in place as /etc...
Why the /etc/nshadow file remains after changing root password?
1,433,520,021,000
Doing: # newusers username::1002:1002::/home/username:/bin/bash ^D No password supplied No password supplied No password supplied newusers: (user username) pam_chauthtok() failed, error: Authentication token manipulation error newusers: (line 1, user username) password not changed adds the user with no password (with...
Leave the password field blank. newusers will complain repeatedly about 'No password supplied' and being unable to change the password, but the users will be created with ! (i.e. invalid password) in the shadow password field. username::1002:1002::/home/username:/bin/bash instead of: username:*:1002:1002::/home/user...
How to bulk add disabled-password users?
1,433,520,021,000
Does the supplied password during login get converted to a salted hash and then compared to the one in /etc/shadow? /what if the user is in LDAP but not in the shadow file? Would it use kerberos?
For salt, the idea is simple: 3DES for example has 11 characters of hashed password plus 2 characters of salt. Lets say the outcome is: SSHHHHHHHHHHH. That's what's stored in the shadow file. I.e. both the salt and the hash. Once I type my password, the library gets the shadow entry, extracts the salt (first two chara...
How does the authentication process with the salted hash in shadow work
1,433,520,021,000
We have a Linux system running Centos 7 and have an issue with the screen lock. We have a multi-user environment where each user has their own account. The authentication is using our university active directory. Only local accounts use the passwd & shadow files and indeed if a local account locks the screen they a...
We figured it out ... the kscreensaver file located in /etc/pam.d was misconfigured during a recovery update. We had backup files of the kscreensaver configuration file and simply copied using cp command to the original condition before the update. #%PAM-1.0 # This file is auto-generated. # User changes will be dest...
Screen Lock Checks password file but not Active Directory
1,433,520,021,000
I have written a manifests using users resource as shown below node 'node2.example.com','node3.example.com'{ user { 'ash': ensure => 'present', managehome => 'true', comment => 'Zaman Home', home => '/home/ash', shell => '/bin/bash', expiry => 'absent', password => '$1$cs1j/t.D$4qjZLwFQ2Ocr0pulyNT...
ruby-shadow should be installed on all hosts which are being managed using puppet. Verify it is loaded properly by running the below command. #ruby -e "require 'puppet' ; puts Puppet.features.libshadow?" true The package is available for download from the following location http://pkgs.repoforge.org/ruby-shadow/
users resource in Puppet not updating /etc/shadow
1,433,520,021,000
The following command is being executed by a non root user : perl -pi -e 's/^an24:/an24:\*LK*/g' /etc/shadow A permission denied is being issued. This indicates some privileges issues. Can such command be executed? I tried to set the setuid and group id on the script executing this command with no success. The Ope...
Use sudo: sudo perl -pi -e 's/^an24:/an24:\*LK*/g' /etc/shadow
Perl - /etc/shadow - Permission Denied
1,433,520,021,000
I am trying to backup several servers' /etc by using rsync from another server. Here's a relevant snippet: PRIVKEY=/path/to/private.key RSYNC_OPTS="--archive --inplace --no-whole-file --quiet" ssh -n -i $PRIVKEY root@${ip} "rsync $RSYNC_OPTS /etc 192.168.25.6::"'$(hostname)' where ${ip} is the IP Address of the serve...
File permissions do not really apply to root: Programs running as root can read and write files regardless of protection settings. (However, even root cannot execute a file unless one of the execute bits is set; it does not matter which one). That explains why cat can do it. But apparently, rsync runs its own check in...
How to backup /etc/{,g}shadow files with 0000 permission?
1,433,520,021,000
I had created two users on Linux with the same exact passwords, but when I looked at the /etc/shadow file, I found that the hashed values look different, although the salt file is the same. (Please see below, j9T is the salt). Why the hashed passwords are NOT similar, although the slat and password are similar? # tail...
The second field (j9T) is not the salt, it's the param (hash complexity parameter). You could read more information about the format of the hash here and here You salt is actually the third field, and you can see it's different. The actual hash is the fourth field.
Hashed passwords are NOT similar although the salt and password are similar
1,433,520,021,000
I have the following users with password from /etc/shadow: userA:$5$FSRFdXhqehxiiFZV$SoIvO/4Y2tvOzIi.8p1Ud6AInQ3K5XT/WqVE5Zh4GT8:18388:0:99999:7::: userB:*:18388:0:99999:7::: userC:$6$SJRweUUklycIq1C$ZKCPyeM9bAoTynYioSYBOmZTATXsajucfHNE3ZNfWNmql1GKdsYCTprf/aXOspBxxzlRuDEvjRlzLf7rbx.fy0:18388:0:99999:7::: userD:$6$YgVQ...
The password hashing schemes $5$ and $6$ are not just single SHA256 or SHA512 hashes of the password + salt. That would be way too easy to brute-force. Instead, the hashing is iterated a configurable number of times: if the password hash does not include a $rounds=N$ specifier, the default is 5000 iterations. You'll f...
Define the user with the specific password
1,433,520,021,000
What is the practical difference between setting *LK* in /etc/shadow and setting /usr/sbin/nologon in /etc/passwd? When would we choose one over the other? When would we combine them?
Setting a value that is not a valid password hash, such as *LK* to the password hash field of /etc/shadow will block all forms of password authentication, but if the user has other authentication mechanisms (like fingerprints or SSH keys) configured, they will still work. As a special case of this, passwd -l <username...
Difference between *LK* in /etc/shadow and /usr/sbin/nologon in /etc/passwd
1,433,520,021,000
Once in a while, my server throws this error when trying to run the shadow service. I can delete the users (http and ftp) but they keep reappearing. I don't want to add the directories, nor do I need the users. Why do they keep coming back and how can I stop this? UPDATE: I just saw this during an update: (17/35) upgr...
I found a discussion on the Arch Linux forums related to this issue: https://bbs.archlinux.org/viewtopic.php?id=234525 As per this discussion, the users are created by the systemd-sysusers component. This component creates system users and groups and runs during the installation/upgrade of systemd. The configuration f...
Shadow service "user 'ftp': directory '/srv/ftp' does not exist"
1,433,520,021,000
I would like assistance with something I have to do. I need to verify if all users in passwd are also in shadow, if the primary group exists, if the homedir exists and if it belongs to the correct user/group. If something is wrong, it should output it to a new file, called for example "errors". How can I implement a s...
pwck is probably what you seek. The pwck command verifies the integrity of the users and authentication information. It checks that all entries in /etc/passwd and /etc/shadow have the proper format and contain valid data. The user is prompted to delete entries that are improperly formatted or which have other uncorre...
Need help with a script that uses passwd and shadow
1,433,520,021,000
My goal I have an old MySQL database with usernames and passwords hashed using sha256. I don't have the original passwords and it is not possible to learn them. This is a simple user migration from a database to a Linux system. I need to create all those users on linux, because that linux authentication will be used i...
No, sorry, you can't use the old hash directly to generate the new one. For one, you're talking about having the SHA-256 hash, and then using that to calculate a SHA-512 based hash, which won't happen without inverting the SHA-256 hash. Second, even if you were to use the crypt algorithm based on the same hash ($5$ fo...
How can I use existing password-sha256, to allow login authorisation?
1,433,520,021,000
Kindly assist to to get user creation details (date and time) and users login details in Solaris 10
You can try by dates of ~/.login file or via first login date in wtmp. But none of these methods with give trustworthy answer to your question.
How to get user creation details
1,525,288,972,000
I was going through documentation regarding mmap here and tried to implement it using this video. I have a few questions regarding its implementation. Does mmap provide a mapping of a file and return a pointer of that location in physical memory or does it return with an address of the mapping table? And does it allo...
Answering things in order: It returns a pointer to the location in virtual memory, and virtual memory address space is allocated, but the file is not locked in any way unless you explicitly lock it (also note that locking the memory is not the same as locking the region in the file). An efficient implementation of m...
Understanding mmap
1,525,288,972,000
I've been curious lately about the various Linux kernel memory based filesystems. Note: As far as I'm concerned, the questions below should be considered more or less optional when compared with a better understanding of that posed in the title. I ask them below because I believe answering them can better help me to ...
There is no difference betweem tmpfs and shm. tmpfs is the new name for shm. shm stands for SHaredMemory. See: Linux tmpfs. The main reason tmpfs is even used today is this comment in my /etc/fstab on my gentoo box. BTW Chromium won't build with the line missing: # glibc 2.2 and above expects tmpfs to be mounted at...
On system memory... specifically the difference between `tmpfs,` `shm,` and `hugepages...`
1,525,288,972,000
I'm just wondering where these values are being set and what they default to? Mine is currently 18446744073692774399. I didn't set it anywhere that I can see. $ cat /proc/sys/kernel/shmmax 18446744073692774399 $ sysctl kernel.shmmax kernel.shmmax = 18446744073692774399
The __init function ipc_ns_init sets the initial value of shmmax by calling shm_init_ns, which sets it to the value of the SHMMAX macro. The definition of SHMMAX is in <uapi/linux/shm.h>: #define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */ On 64-bit machines, that definition equals the value yo...
Where does Linux set the default values for SHMMAX?
1,525,288,972,000
Is it good practice to create a directory in /run/shm (formerly /dev/shm) and use that like a temp directory for an application? Background: I am writing black box tests for a program which does a lot of stuff with files and directories. For every test I create a lot of files and directories and then run the program a...
It's perfectly okay to use some directory in /run as long as you have the appropriate rights on it. In some modern distros, /tmp is already a virtual file system in memory or a symlink to a directory inside /run. If this is your case (you can check that in /etc/fstab, or typing mtab), you could use /tmp as your tempor...
use `/run/shm` (formerly `/dev/shm`) as a temp directory
1,525,288,972,000
In my dmesg this appeared when my window manager (xfwm4, part of XFCE) crashed: xfwm4[3936]: segfault at 7f3c7c523770 ip 00007f3c7c523770 sp 00007ffffea1ee28 error 15 in SYSV00000000 (deleted)[7f3c7c4e8000+60000] The same SYSV00000000 also appears in other places (like lsof). So, what is this SYSV00000000? I Googled...
The kernel is telling you that when the segfault occurred, the instruction pointer 0x7f3c7c523770 was in a SysV IPC shm segment. The shared memory segment started at 0x7f3c7c4e8000 and was 0x60000 bytes long. SysV shm segments are not backed by a file, so the string SYSV00000000 appears where normally you'd get the fi...
What is "SYSV00000000"?
1,525,288,972,000
when loading a shared library in Linux system, what is the memory layout of the shared library? For instance, the original memory layout is the following: +-----------+ |heap(ori) | +-----------+ |stack(ori) | +-----------+ |.data(ori) | +-----------+ |.text(ori) | +-----------+ When I dlopen foo.so, will the memory...
The answer is "Other". You can get a glimpse of the memory layout with cat /proc/self/maps. On my 64-bit Arch laptop:: 00400000-0040c000 r-xp 00000000 08:02 1186758 /usr/bin/cat 0060b000-0060c000 r--p 0000b000 08:02 1186758 /usr/bin/cat 0060c000-0060d000 rw-p 000...
Memory layout of dynamic loaded/linked library
1,525,288,972,000
What exactly are shmpages in the grand scheme of kernel and memory terminology. If I'm hitting a shmpages limit, what does that mean? I'm also curious if this applies to more than linux
User mode processes can use Interprocess Communication (IPC) to communicate with each other, the fastest method of achieving this is by using shared memory pages (shmpages). This happens for example if banshee plays music and vlc plays a video, both processes have to access pulseaudio to output some sound. Try to fi...
What are shmpages in laymans terms?
1,525,288,972,000
I am repeating tens of thousands of similar operations in /dev/shm, each with a directory created, files written, and then removed. My assumption used to be that I was actually creating directories and removing them in place, so the memory consumption had to be quite low. However it turned out the usage was rather hig...
Curious, as you're running this application what does df -h /dev/shm show your RAM usage to be? tmpfs By default it's typically setup with 50% of whatever amount of RAM the system physically has. This is documented here on kernel.org, under the filesystem documentation for tmpfs. Also it's mentioned in the mount man p...
operation in /dev/shm causes overflow
1,525,288,972,000
Varnish, a HTTP accelerator, uses a ~80MB file backed SHM log that is mlock()ed into memory. The Varnish docs recommend to store the file on tmpfs to avoid unnecessary disk access. However if the entire file is locked into memory, does the Linux kernel still write to the backing file? I tried to monitor this using ino...
Varnish appears to use a plain memory-mapped file for its shared memory (instead of, e.g., POSIX shm_open). From the source: loghead = mmap(NULL, heritage.vsl_size, PROT_READ|PROT_WRITE, MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, heritage.vsl_fd, 0); On BSD, MAP_NOSYNC requests that the kernel not write ...
File backed, locked shared memory and disk interaction
1,525,288,972,000
I need to know the amount of memory shared between two processes, that is, the intersection of their shared memories. Any ideas?
You can look at /proc/<pid>/maps, /proc/<pid>/smaps (or pmap -x <pid> if your OS supports) of interested process ID's and compare outputs to determine shared memory regions. That includes shared memory segments via shmget calls, as well as any shared libraries, files. Edit: As mr.spuratic pointed out his answer here h...
How to know shared memory between two processes?
1,525,288,972,000
I run DB2 on Linux where I have to allocate the vast majority of memory on the machine to shared memory segments. This page is typical of the info that I've found about shmall/shmmax: http://www.pythian.com/news/245/the-mysterious-world-of-shmmax-and-shmall/ My system is running fine now, but I'm wondering if there's ...
Shared memory is not always a protected resource. As such many users can allocate shared memory. It is also not automatically returned to the memory pool when the process which allocated it dies. This can result in shared memory allocations which have been allocated but not used. This results in a memory leak that...
Linux - why is kernel.shmall so low by default?
1,525,288,972,000
If file descriptors are specific to each process (i.e. two processes may use the same file descriptor id to refer to different open files) then how is it possible to share transfer file descriptors (e.g. for shared mmaps) over sockets etc? Does it rely on the kernel being mapped to the same numerical address range und...
When you share a file descriptor over a socket, the kernel mediates. You need to prepare data using the cmsg(3) macros, send it using sendmsg(2) and receive it using recvmsg(2). The kernel is involved in the latter two operations, and it handles the conversion from a file descriptor to whatever data it needs to transm...
Sharing file descriptors
1,525,288,972,000
Are sharing a memory-mapped file and sharing a memory region implemented based on each other? The following two quotes seem to say so, and seem a chicken-egg problem to me. Operating System Concepts introduces sharing a memory-mapped file in the following. Do the multiple processes share the same file by sharing the ...
Shared memory can be backed by a regular file, a block device, or swap. It depends on how the memory region was created. When multiple processes are using the same shared memory region, their individual virtual addresses will be pointing to the same physical address. Writes by one process become visible to others dire...
Are sharing a memory-mapped file and sharing a memory region implemented based on each other?
1,525,288,972,000
I need to create /dev/shm on an embedded ARM system. From "Installed The Latest Changes to Current and......". I see that it can be created with mkdir /lib/udev/devices/shm, but I'm wondering what is supposed to be at that location? The only directory I have at that location is /lib/modules/, there's no devices/ or ...
An embedded system may have a static /dev, rather than use udev to populate it. If you don't have /lib/udev, then presumably your system isn't running udev. In that case, you need to create /dev/shm on the root filesystem. If the root filesystem is an initramfs, rebuild your initramfs with an extra line in the initram...
can not create /dev/shm
1,525,288,972,000
I am conducting some research on Grsecurity on Hardened Gentoo, see http://en.wikibooks.org/wiki/Grsecurity. To be more specific, I am trying to find an example where subject mode x makes a difference. As said in the wiki: subject mode x: Allows executable anonymous shared memory for this subject. Now, the kernel reje...
According to Brad Spengler the subject mode x applies to System V shared memory only, see http://forums.grsecurity.net/viewtopic.php?f=5&t=3935. On top of that PaX strikes unless MPROTECT is disabled for the binary under consideration.
Grsecurity subject mode x
1,525,288,972,000
I found this Q&A saying shared libraries can be shared between processes using shared memory. It seems like it would be impossible, though, to share code between processes without some pretty severe restrictions on the type of code that can be shared. I'm thinking about libraries with non-reentrant C functions whose o...
I believe that the really short answer is that Linux compilers arrange code into pieces, at least one of which is just pure code, and can therefore be memory mapped into more than one process' address space. Any globals get mapped such that each process gets its own copy. You can see this using readelf, or objdump, bu...
non-reentrant libraries in shared memory?
1,525,288,972,000
This is a combination of programming and Linux question but I think it suits better here. I am writing an application that works with ipcs (shared memory segments) and after each running I am checking if any ipcs are left using the bash command ipcs. I noticed a lot more than I created so I thought they are part of th...
By system clock I mean the clock that tells the time down right of the panel "System clock" generally refers to the clock maintained by the kernel; applications such as date and GUI clocks such as the one you refer to make calls to it like this. Why, out of all the processes that the system runs, does the clock ne...
Why does the clock need a shared memory segment?
1,525,288,972,000
There are many questions on Stack Overflow asking about how a system handles memory leaks and what happens on abnormal termination. Examples: https://stackoverflow.com/questions/6727383/dynamically-allocated-memory-after-program-termination https://stackoverflow.com/questions/10223677/when-a-program-terminates-what-ha...
When a process dies, its memory is reclaimed by the operating system. It's marked as free, and will be allocated to other processes sooner or later when other processes require memory. The memory is always wiped before being allocated to a process. It doesn't matter that there's been memory corruption in the process. ...
How is memory corruption handled by Linux when the process terminates?