The question explains it all. I am using Ubuntu 20.04 LTS. I have connected an android smartphone to pc using USB. Changed directory to internal storage using:

cd /run/user/*/gvfs/*/'Internal Shared Storage'

And now I wanna create a bash script. Did this:

touch test.sh

But it says:

touch: setting times of 'test.sh': Operation not supported

But if I 'ls' again, I see 'test.sh' actually got created. So whatever, I do this to edit 'test.sh' using vim:

vim test.sh

But got this:

cannot open path of the current working directory: Permission denied

Doing sudo outputs the same error. Is it possible to do what I am trying to do?

Android version is 8.

  • Cross-posted from Ubuntu.SE: askubuntu.com/q/1363757/331791
    – Andrew T.
    Sep 15, 2021 at 13:22
  • 2
    If you access your phone via Ubuntu/MTP then editing is not directly possible. There may be an emulation for file editing (download file from device to temp file, wait for the editor to be closed and re-upload the file to the device). As MTP is not a very stable protocol I would not recommend to use it. If you want to edit a file on-device better enable adb and used adb shell for your commands.
    – Robert
    Sep 15, 2021 at 13:32
  • @Robert thanks for your reply. Another question. What if I have a pre-written bash script and I just copy it in the connected device and run it? I would get the same permission error right? How would I overcome that?
    – SuperNoob
    Sep 15, 2021 at 13:45
  • 2
    On Android there is no bash and the number of common Linux commands is also reduced. But a shell script should work. Note that the internal storage on Android is mounted with noexec option.
    – Robert
    Sep 15, 2021 at 13:57
  • @Robert Thank you!
    – SuperNoob
    Sep 15, 2021 at 14:58


You must log in to answer this question.

Browse other questions tagged .