{"id":8146,"date":"2026-09-02T02:08:54","date_gmt":"2026-09-02T09:08:54","guid":{"rendered":"https:\/\/catbradley.io\/?p=8146"},"modified":"2026-09-02T02:08:54","modified_gmt":"2026-09-02T09:08:54","slug":"how-to-change-raspberry-pi-wi-fi-details-from-the-sd-card","status":"publish","type":"post","link":"https:\/\/catbradley.io\/?p=8146","title":{"rendered":"How to Change Raspberry Pi Wi-Fi Details From the SD Card"},"content":{"rendered":"<figure><img decoding=\"async\" src=\"https:\/\/itsfoss.com\/content\/images\/2026\/09\/change-wifi-details-raspberrypi-sd-card.webp\" alt=\"Change Raspberry Pi WiFi password from SD card\" loading=\"lazy\" \/><\/figure>\n<p>If your Raspberry Pi can no longer connect to Wi-Fi because the SSID or password changed, you can update the Wi-Fi configuration directly from its SD card. This helps when you cannot connect the device to a monitor and keyboard.<\/p>\n<p>That&#8217;s what I did. I had switched to a different internet provider, and that changed the router, its SSID and the password. I was using a Raspberry Pi Pico W in <a href=\"https:\/\/itsfoss.com\/raspberry-pi-dog-review\/\" rel=\"noreferrer\">my Pi Dog<\/a>. Connecting it to a screen and keyboard would have been a pain.<\/p>\n<p>The easier option was to just take out the SD card and edit the WiFi details directly there. The entire process is composed of the following step:<\/p>\n<ul>\n<li>Insert the SD card with Raspberry Pi OS on it on your (Linux) computer<\/li>\n<li>Go to the mounted rootfs partition and go to \/etc\/NetworkManager\/system-connections\/ location<\/li>\n<li>Here, either create or edit <code>.nmconnection<\/code> file and enter the wifi name (SSID) and password<\/li>\n<\/ul>\n<p>Let me show that in detail for you.<\/p>\n<div class=\"kg-card kg-callout-card kg-callout-card-red\">\n<div class=\"kg-callout-emoji\">\ud83d\udea7<\/div>\n<div class=\"kg-callout-text\">Older Raspberry Pi OS releases may use <code>wpa_supplicant.conf<\/code> instead of NetworkManager. In that case, this method may not entirely be applicable. I have tested it on Raspberry Pi 5 running Raspberry Pi OS based on Debian Trixie.<\/div>\n<\/div>\n<h2>Step 1: Connect the SD card to your computer<\/h2>\n<p>Shut down the Raspberry Pi, remove the microSD card, and insert it into your Linux laptop or desktop using an SD card reader.<\/p>\n<p>Raspberry Pi OS usually has two partitions:<\/p>\n<pre><code class=\"language-text\">bootfs\nrootfs\n<\/code><\/pre>\n<p>The Wi-Fi configuration is stored inside the <code>rootfs<\/code> partition.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/itsfoss.com\/content\/images\/2026\/09\/raspberry-pi-wifi-change-sd-1-1.png\" class=\"kg-image\" alt=\"Mounted rootf and bootfs partitions\" loading=\"lazy\" width=\"1271\" height=\"581\" \/><\/figure>\n<h2>Step 2. Find the SD card mount points<\/h2>\n<p>Open a terminal and run:<\/p>\n<pre><code class=\"language-bash\">lsblk -f\n<\/code><\/pre>\n<p>You should see something similar to:<\/p>\n<pre><code class=\"language-text\">sda\n\u251c\u2500sda1   vfat     FAT32 bootfs B2F0-82D2                             438.1M    13% \/run\/media\/abhishek\/bootfs\n\u2514\u2500sda2   ext4     1.0   rootfs 15f4c6be-1102-4331-9904-f78e78afd1fd   21.9G    18% \/run\/media\/abhishek\/rootfs\n<\/code><\/pre>\n<p>If you only see bootfs, mounted, you can mount rootfs from the file explorer.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/itsfoss.com\/content\/images\/2026\/09\/raspberry-pi-wifi-change-sd-3-1.png\" class=\"kg-image\" alt=\"\" loading=\"lazy\" width=\"1756\" height=\"366\" \/><\/figure>\n<p>As you can see, for me, the Raspberry Pi root filesystem is available at:<\/p>\n<pre><code class=\"language-bash\">\/run\/media\/abhishek\/rootfs<\/code><\/pre>\n<p>You can also confirm it with:<\/p>\n<pre><code class=\"language-bash\">mount | grep rootfs\n\/dev\/sda2 on \/run\/media\/abhishek\/rootfs type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2\n<\/code><\/pre>\n<h2>Step 3. Check the existing Wi-Fi configuration<\/h2>\n<p>Recent Raspberry Pi OS releases store NetworkManager connection profiles here:<\/p>\n<pre><code class=\"language-text\">\/etc\/NetworkManager\/system-connections\/\n<\/code><\/pre>\n<div class=\"kg-card kg-callout-card kg-callout-card-red\">\n<div class=\"kg-callout-emoji\">\ud83d\udea7<\/div>\n<div class=\"kg-callout-text\">Make sure to use your own username and the correct path of rootfs and files by replacing them in the command examples. You can also keep on using $USER as this environment variable automatically uses your username.<\/div>\n<\/div>\n<p>Since we are accessing Raspberry Pi OS through its SD card, run:<\/p>\n<pre><code class=\"language-bash\">sudo ls -la \/run\/media\/$USER\/rootfs\/etc\/NetworkManager\/system-connections\/\n<\/code><\/pre>\n<p>If you already see a <code>.nmconnection<\/code> file, you can edit that file. <\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/itsfoss.com\/content\/images\/2026\/09\/raspberry-pi-wifi-change-sd-4-1.png\" class=\"kg-image\" alt=\"Network manager connection file in rootfs of Raspberry PI SD card\" loading=\"lazy\" width=\"1884\" height=\"766\" \/><\/figure>\n<h3>No nmconnection file? Create one<\/h3>\n<p>If the directory is empty, create a new Wi-Fi profile.<\/p>\n<pre><code>touch \/run\/media\/$USER\/rootfs\/etc\/NetworkManager\/system-connections\/home-wifi.nmconnection<\/code><\/pre>\n<p>And then use a <a href=\"https:\/\/itsfoss.com\/nano-like-editors\/\" rel=\"noreferrer\">terminal-based text editor like Nano<\/a> or even Micro and add the following details:<\/p>\n<div class=\"kg-card kg-callout-card kg-callout-card-red\">\n<div class=\"kg-callout-emoji\">\ud83d\udea7<\/div>\n<div class=\"kg-callout-text\">In the text below, change the value of <code>ssid<\/code> and <code>psk<\/code> with your wifi access point name and its password.<\/div>\n<\/div>\n<pre><code>[connection]\nid=home-wifi\ntype=wifi\ninterface-name=wlan0\nautoconnect=true\n\n[wifi]\nmode=infrastructure\nssid=YOUR-WIFI-SSID\n\n[wifi-security]\nkey-mgmt=wpa-psk\npsk=YOUR-WIFI-PASSWORD\n\n[ipv4]\nmethod=auto\n\n[ipv6]\nmethod=auto\nEOF<\/code><\/pre>\n<h2>Step 4. Set the correct file permissions<\/h2>\n<p>Your work is almost done. You just need to set correct file permissions. That&#8217;s because NetworkManager expects connection files to be readable only by root.<\/p>\n<p>To give it the <a href=\"https:\/\/linuxhandbook.com\/linux-file-permissions\/\">correct file permissions<\/a>, use the following command:<\/p>\n<pre><code class=\"language-bash\">sudo chmod 600 \/run\/media\/$USER\/rootfs\/etc\/NetworkManager\/system-connections\/home-wifi.nmconnection\n<\/code><\/pre>\n<p>Verify the permissions:<\/p>\n<pre><code class=\"language-bash\">sudo ls -l \/run\/media\/$USER\/rootfs\/etc\/NetworkManager\/system-connections\/\n<\/code><\/pre>\n<p>The file should look something like:<\/p>\n<pre><code class=\"language-text\">-rw------- 1 root root ... home-wifi.nmconnection\n<\/code><\/pre>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/itsfoss.com\/content\/images\/2026\/09\/raspberry-pi-wifi-change-sd-5.png\" class=\"kg-image\" alt=\"Verify that the system connections file has correct file permission\" loading=\"lazy\" width=\"2000\" height=\"639\" \/><\/figure>\n<div class=\"kg-card kg-callout-card kg-callout-card-blue\">\n<div class=\"kg-callout-emoji\">\ud83d\udccb<\/div>\n<div class=\"kg-callout-text\">Before going further, double ensure that you have used the correct WiFi SSID and the password. Any typo and you will have to repeat the process. You won&#8217;t want that to happen.<\/div>\n<\/div>\n<h2>Step 5. Flush the changes to the SD card before removing<\/h2>\n<p>This is an important step. After making all the changes, run this command:<\/p>\n<pre><code class=\"language-bash\">sync\n<\/code><\/pre>\n<p>The <code>sync<\/code> command makes sure any pending writes cached in memory are actually written to the SD card.<\/p>\n<p>And then you can either unmount from the file explorer or <a href=\"https:\/\/linuxhandbook.com\/umount-command\/\">use the umount command<\/a> for both partitions:<\/p>\n<pre><code class=\"language-bash\">sudo umount \/run\/media\/$USER\/rootfs\nsudo umount \/run\/media\/$USER\/bootfs\n<\/code><\/pre>\n<p>You can now safely remove the SD card.<\/p>\n<h2>Step 6. Verifying the connection<\/h2>\n<p>Insert the card back into the Raspberry Pi and power it on. After it boots, <a href=\"https:\/\/itsfoss.com\/how-to-find-what-devices-are-connected-to-network-in-ubuntu\/\" rel=\"noreferrer\">check the devices connected on your network<\/a> to find the Raspberry Pi&#8217;s IP address. <\/p>\n<p>The simplest way would be to log in to your router and see the connected devices.<\/p>\n<p>Otherwise, <a href=\"https:\/\/angryip.org\/download\/#linux\">Angry IP Scanner<\/a> is a good graphical tool for scanning your network. Command line tool nmap also does the job:<\/p>\n<pre><code class=\"language-bash\">sudo nmap -sn 192.168.0.0\/24\n<\/code><\/pre>\n<p>Normally, it should show your Raspberry Pi&#8217;s hostname. You can also try to run scan before turning on Pi and a few minutes after turning it on. This should show the new devices that turn up between the two scans.<\/p>\n<p>Finally, check the connectivity with:<\/p>\n<pre><code class=\"language-bash\">ping RASPBERRY_PI_IP\n<\/code><\/pre>\n<p>Or, if <a href=\"https:\/\/itsfoss.com\/ssh-into-raspberry\/\" rel=\"noreferrer\">SSH is enabled on your Raspberry Pi<\/a>, connect to it:<\/p>\n<pre><code class=\"language-bash\">ssh username@RASPBERRY_PI_IP\n<\/code><\/pre>\n<p>By the way, if you have <a href=\"https:\/\/itsfoss.com\/reset-raspberry-pi-password\/\" rel=\"noreferrer\">forgotten the user password of your Raspberry Pi<\/a>, that can be easily reset too. <\/p>\n<p>Enjoy your Raspberry Pi \ud83d\ude04<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/feed.itsfoss.com\/link\/24361\/17437078.gif\" height=\"1\" width=\"1\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>If your Raspberry Pi can no longer connect to Wi-Fi because the SSID or password changed, you can update the Wi-Fi configuration directly from its SD card. This helps when&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":[],"rop_publish_now_history":[],"rop_publish_now_status":"pending","footnotes":""},"categories":[1],"tags":[],"class_list":["post-8146","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rss"],"_links":{"self":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/posts\/8146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8146"}],"version-history":[{"count":0,"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/posts\/8146\/revisions"}],"wp:attachment":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}