slack-term icon indicating copy to clipboard operation
slack-term copied to clipboard

Permission denied on .slack-term

Open shyamsathyanathan opened this issue 6 years ago • 13 comments

I have made a fresh installation of slack-term from Ubuntu-18.04 GNOME Software. I have also created the .slack-term file in my home directory as shown on the README. But whenever I try to launch the application from terminal, I get this

couldn't find the slack-term config file: open /home/shyam/.slack-term: permission denied

However,

~ 
➜ pwd
/home/shyam
~ 
➜ ls -l .slack-term 
-rwxrwxrwx 1 shyam shyam 1815 Apr 30 10:42 .slack-term

Note: the permissions have been edited by me to 777 just to make sure that this isn't actually a permission issue at all.

I have also edited the file to add my token and removed all the comments to make sure that it is a valid JSON. (Even if this was indeed the problem, the error thrown is unclear)

shyamsathyanathan avatar Apr 30 '18 05:04 shyamsathyanathan

If you installed slack-term using GNOME Software, config directory seems to be $HOME/snap/slack-term/current/slack-term.json, you can launch program using slack-term --config $HOME/snap/slack-term/current/slack-term.json. This probably has something to do with snap sandboxing..

Kehet avatar May 16 '18 06:05 Kehet

The same problem in my case. This should be "bug" not "question". Also in my case this is NOT problem of permissions. Content of my config file: { "slack_token": "***************************************" } Even if I manually select path to file there is no change: slack-term -config /home/fidlip/.slack-term When I run it as root with sudo, no difference.

My system: Ubuntu 18.04

fidlip avatar May 16 '18 15:05 fidlip

I realized now, it is problem of Ubuntu package. If I download binary from github, It seem to be OK...

fidlip avatar May 16 '18 15:05 fidlip

Yup. The sandboxing means slack-term snap has access to limited directories. As @Kehet points out running slack-term --config $HOME/snap/slack-term/current/slack-term.json and keeping your config files there works fine. I use this for multiple slacks.

popey avatar May 16 '18 18:05 popey

@fidlip It would be a good idea to remove your slack token from here and get a new one.

shyamsathyanathan avatar May 17 '18 05:05 shyamsathyanathan

Good point, thanks

fidlip avatar May 17 '18 07:05 fidlip

Hi: this problem persists, I'm afraid. Downloaded from github, but experiencing same, no matter which of strategies suggested above. [Ubuntu 18.04]

dbdennis avatar May 19 '18 15:05 dbdennis

What is full path of your configuration file?

fidlip avatar May 19 '18 21:05 fidlip

Sorry for the delayed response: home/name/.slack-term

dbdennis avatar May 20 '18 13:05 dbdennis

I think this is confusing for people using snap to install slack-term. Maybe that we should update snapcraft.yml file to improve clarity or add a note in the Readme Setup section. WDYT @erroneousboat ?

spuyet avatar Jul 07 '18 07:07 spuyet

@dbdennis see my comment above. Your config file should be $HOME/snap/slack-term/current/slack-term.json (or something else in $HOME/snap/slack-term/current/. Then launch with slack-term --config $HOME/snap/slack-term/current/slack-term.json

popey avatar Jul 07 '18 08:07 popey

For anyone else experiencing this problem, I was hoping to produce an easy step-by-step process to see what is going on and help debug. Here is what I came up with... I invoked slack-term from the command line using strace as follows to debug further:

$ sudo apt-get install strace
Reading package lists... Done
Building dependency tree       
Reading state information... Done
strace is already the newest version (4.15-2).
The following packages were automatically installed and are no longer required:
  libgsoap7 libpng12-0 libqt4-opengl libvncserver1 libvpx3
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 173 not upgraded.
$ chmod 000 ~/.slack-term
$ strace -f -o strace-slack-term.log ~/projects/gopath/bin/slack-term
<if slack-term doesn't quit on its own, exit it>
$ egrep '\.slack-term' strace-slack-term.log
32451 openat(AT_FDCWD, "/home/cmyers/.slack-term", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
$ chmod 400 ~/.slack-term
$ strace -f -o strace-slack-term.log ~/projects/gopath/bin/slack-term
<if slack-term doesn't quit on its own, exit it>
$ egrep '\.slack-term' strace-slack-term.log
31239 openat(AT_FDCWD, "/home/cmyers/.slack-term", O_RDONLY|O_CLOEXEC) = 6

"openat" is the api slack-term uses to try to open your slack-term file. You can see the exact path it is trying to read, in my case, "/home/cmyers/.slack-term". The first time, you can see it gets permission denied (-1 EACCESS), the second time it works correctly (because I fixed the permissions).

I'm hoping the above steps will help folks determine what is going on themselves more easily.

terabyte avatar Oct 15 '18 23:10 terabyte

I have made a fresh installation of slack-term from Ubuntu-18.04 GNOME Software. I have also created the .slack-term file in my home directory as shown on the README. But whenever I try to launch the application from terminal, I get this

couldn't find the slack-term config file: open /home/shyam/.slack-term: permission denied

However,

~ 
➜ pwd
/home/shyam
~ 
➜ ls -l .slack-term 
-rwxrwxrwx 1 shyam shyam 1815 Apr 30 10:42 .slack-term

Note: the permissions have been edited by me to 777 just to make sure that this isn't actually a permission issue at all.

I have also edited the file to add my token and removed all the comments to make sure that it is a valid JSON. (Even if this was indeed the problem, the error thrown is unclear)

lordvader@lordvader:~$ slack-term 2020/01/23 15:14:26 couldn't find the slack-term config file: open /home/lordvader/.slack-term: permission denied

lordvader@lordvader:~$ pwd /home/lordvader

lordvader@lordvader:~$ ls -l .slack-term -rw-rw-rw- 1 lordvader lordvader 0 Jan 23 14:52 .slack-term

help how to fix it

lordvader501 avatar Jan 23 '20 09:01 lordvader501