3

When plugging in my SD card, I get a message saying "not authorized to perform operation." I can mount it using sudo, but I can't create files on it in nautilus unless I'm running it as root. sudo chown -R user:user sdcard gives me: chown: changing ownership of 'sdcard': Operation not permitted I tried reinstalling policykit, and it changed nothing.

Edit: I reinstalled ubuntu 18.04 the sd card worked for awhile, then I tried plugging in a usb 3.0 jumpdrive that I just bought, and I got notified of a software update, so I updated, and now I'm back in the same situation... my apt histoty:

Start-Date: 2019-12-21  21:14:00
Commandline: aptdaemon role='role-commit-packages' sender=':1.122'
Upgrade: python3-software-properties:amd64 (0.96.24.32.11, 0.96.24.32.12), python2.7-minimal:amd64 (2.7.15-4ubuntu4~18.04.2, 2.7.17-1~18.04), libpython2.7:amd64 (2.7.15-4ubuntu4~18.04.2, 2.7.17-1~18.04), google-chrome-stable:amd64 (79.0.3945.79-1, 79.0.3945.88-1), python2.7:amd64 (2.7.15-4ubuntu4~18.04.2, 2.7.17-1~18.04), software-properties-gtk:amd64 (0.96.24.32.11, 0.96.24.32.12), ubuntu-drivers-common:amd64 (1:0.5.2.4, 1:0.5.2.5), libpython2.7-minimal:amd64 (2.7.15-4ubuntu4~18.04.2, 2.7.17-1~18.04), linux-firmware:amd64 (1.173.13, 1.173.14), libpython2.7-stdlib:amd64 (2.7.15-4ubuntu4~18.04.2, 2.7.17-1~18.04), software-properties-common:amd64 (0.96.24.32.11, 0.96.24.32.12)
End-Date: 2019-12-21  21:14:46

dmesg | tail:

[ 4656.901658] scsi host6: usb-storage 3-2:1.0
[ 4657.920932] scsi 6:0:0:0: Direct-Access     Generic  Mass-Storage     1.11 PQ: 0 ANSI: 2
[ 4657.922055] sd 6:0:0:0: Attached scsi generic sg2 type 0
[ 4658.654229] sd 6:0:0:0: [sdb] 30930944 512-byte logical blocks: (15.8 GB/14.7 GiB)
[ 4658.654485] sd 6:0:0:0: [sdb] Write Protect is off
[ 4658.654490] sd 6:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 4658.654749] sd 6:0:0:0: [sdb] No Caching mode page found
[ 4658.654755] sd 6:0:0:0: [sdb] Assuming drive cache: write through

buckithed
  • 133
  • 1
    What file system is there in the SD card? I suspect a Microsoft file system, and then you set the ownership and permissions when mounting (and you must re-mount in order to change them. See this link – sudodus Dec 10 '19 at 19:05
  • Its fat32. Using that method works, but I still have to run it every time I plug it in. So iI need a way to switch auto-mounting back on. – buckithed Dec 10 '19 at 19:44
  • You can add a line in your file /etc/fstab with the same mount options as you use 'manually' plus auto or noauto. With noautoyou need not specify all opitions. It is enough to specify the label or the mountpoint. See more details in man mount and man fstab. – sudodus Dec 10 '19 at 19:51
  • I'll try that, is fstab supposed to already have a default line that specifies how to mount external memory? – buckithed Dec 10 '19 at 20:00
  • There is no default line. You create it yourseff. This link might be helpful. There is a paragraph about fstab. – sudodus Dec 10 '19 at 20:02
  • While that's helpful, I'd be covering up the problem in that case. – buckithed Dec 10 '19 at 20:28
  • You could also connect your SD card to computer running Windows and use the repair tool in Windows to check and if necessary repair the file system. It might make it more willing to mount automatically. In Windows there is a graphical tool, and also the old chkdsk /f X: where X is the drive letter for that card in Windows. – sudodus Dec 10 '19 at 20:33
  • I actually did that already. It does the same for all my sd cards. – buckithed Dec 10 '19 at 20:34
  • dpkg -l | grep mount please. Normally it should be mount under /media/$USER/. Filesystem is? Any entries in /etc/fstab? USB sticks mounting without problems? – nobody Dec 11 '19 at 12:59
  • dpkg -l | grep mount gives ii libmount1:amd64 2.31.1-0.4ubuntu3.4 amd64 device mounting library ii libmount1:i386 2.31.1-0.4ubuntu3.4 i386 device mounting library ii mount 2.31.1-0.4ubuntu3.4 amd64 tools for mounting and manipulating filesystems filesystem is FAT32, fstab just has an entry for ext4 which I think may be the main filesystem, and swap space. Also same with usb. – buckithed Dec 11 '19 at 18:30
  • This might be a silly question but is the slider on the side of the SD card set to "locked"? – JuanFraItu Jul 06 '22 at 19:45

2 Answers2

0

It sounds like a permissions issue if you are able to edit/create files as root but not as your user. If that is the case then you just need to change the file permissions of your sdcard so that your use can edit it. So, open up a terminal and navigate to wherever your sdcard is mounted, for example /mnt/sdcard:

cd /mnt
sudo chown -R $(whoami):$(whoami) sdcard

Also check the file permissions. You probably want them to be 750, at least.

cd /mtn
chmod 750 sdcard

Now you should be able to edit files as your user without switching to root. Regarding not being able to automatically mount the drive, there are a few reason that could be happening. We would need more information to help you with that. Please see this thread.

Chev_603
  • 1,676
  • 3
  • 18
  • 30