Ubuntu – Telegram only runs with sudo

sudotelegram

I don't know why, but I can only run Telegram with sudo. I just downloaded the tar from desktop.telegram.com and extracted its contents in /usr/local/Telegram.

I can now open the program with:

sudo /usr/local/Telegram/Telegram 

but not with

/usr/local/Telegram/Telegram

If I do the second one, I get an error log:

[2016.10.31 12:53:39] Launched version: 10019, alpha: [FALSE], beta: 0, debug mode: [FALSE], test dc: [FALSE]
[2016.10.31 12:53:39] Executable dir: , name: 
[2016.10.31 12:53:39] Initial working dir: /home/iguarna/
[2016.10.31 12:53:39] Working dir: /home/iguarna/.local/share/TelegramDesktop/
[2016.10.31 12:53:39] Arguments: "Telegram"
[2016.10.31 12:53:39] FATAL: Could not open '/home/iguarna/.local/share/TelegramDesktop/log_startXX.txt' for writing log!
[2016.10.31 12:53:39] Connecting local socket to /tmp/95578c71afe4942c16be0fb6f3bfa82f-{87A94AB0-E370-4cde-98D3-ACC110C5967D}...
[2016.10.31 12:53:39] This is the only instance of Telegram, starting server and app...

What could be the reason?

Best Answer

The error message FATAL: Could not open '/home/iguarna/.local/share/TelegramDesktop/log_startXX.txt' for writing log! shows that you did run telegram as root, and it created the log file (as root), now, the regular user cannot write to the root-owned log file. Fix this by:

sudo chown $(id -u):$(id -g) /home/iguarna/.local/share/TelegramDesktop/log_startXX.txt  

Where you run a program from is immaterial. Who you run a program as is important.