User Tools

Site Tools


linux:telegram

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:telegram [2015/07/01 23:44] – [Step 7: create the system user telegramd] rlunarolinux:telegram [2022/12/02 22:02] (current) – external edit 127.0.0.1
Line 54: Line 54:
 ===== Step 4: a basic test ===== ===== Step 4: a basic test =====
  
-Make a simple confirmation that the program is working. The program is called ''telegram-cli'' and it's under the ''bin'' directory. Go there, and execute: +Make a simple confirmation that the program is working. You can skip this test because we will have to create another user --telegramd-- to run the service and we will have to do it again.  
 + 
 +The program is called ''telegram-cli'' and it's under the ''bin'' directory. Go there, and execute: 
  
 <code> <code>
Line 63: Line 65:
  
 <code> <code>
-rluna@gamora:~/tg-1.0.5.1/bin$ ./telegram-cli ../tg-server.pub -k ../tg-server.pub +$:~/tg-1.0.5.1/bin$ ./telegram-cli ../tg-server.pub -k ../tg-server.pub 
 Telegram-cli version 1.0.5, Copyright (C) 2013-2014 Vitaly Valtman Telegram-cli version 1.0.5, Copyright (C) 2013-2014 Vitaly Valtman
 Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'. Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
Line 85: Line 87:
 ===== Step 5: install the client ===== ===== Step 5: install the client =====
  
-I've opted for manually install the client. I've copied the ''telegram-cli'' program under ''/usr/local/bin/telegram'' and the public key of the server under /etc, with very restricted permissions for reading. +I've opted for manually install the client. I've copied the ''telegram-cli'' program under ''/usr/local/share/telegram'' and the public key of the server under /etc, with very restricted permissions for reading. 
  
 <code> <code>
-# mkdir /usr/local/bin/share/telegram+# mkdir /usr/local/share/telegram
 # cp telegram-cli /usr/local/share/telegram # cp telegram-cli /usr/local/share/telegram
 </code> </code>
Line 101: Line 103:
 </code> </code>
  
-And finnally, copy the configuration information. The configuration information is in your home directory under the folder ''.telegram-cli'':+ 
 +===== Step 6: create the system user telegramd ===== 
 + 
 +In order to run the telegram-daemon as root, you will need to create the user telegramd. I've opted 
 +to create this user as a system user
  
 <code> <code>
-mv /home/YOUR-USER/.telegram-cli/* /etc/telegram+useradd ---user-group --system --shell=/bin/false telegramd
 </code> </code>
  
  
-===== Step 6: create a daemon and install it =====+Impersonate this user and run the telegram-cli program again, to create a proper configuration file:  
 + 
 +<code> 
 +telegramd@:~$ /usr/local/share/telegram/telegram-cli -k /etc/telegram/tg-server.pub  
 +Telegram-cli version 1.0.5, Copyright (C) 2013-2014 Vitaly Valtman 
 +Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'
 +This is free software, and you are welcome to redistribute it 
 +under certain conditions; type `show_license' for details. 
 +Telephone number (with '+' sign):  
 + 
 +</code> 
 + 
 + 
 + 
 +===== Step 7: create a daemon and install it =====
  
 Telegram-cli has a bug that provokes that, unless ''contact_list'' is the first command issued, no message can be sent through the program. Moreover, there is no way to create a program that just sends a message and ends: the program waits forever even if you run through a pipe. __A more simple version to make automatic notifications from a machine would be desirable.__ Telegram-cli has a bug that provokes that, unless ''contact_list'' is the first command issued, no message can be sent through the program. Moreover, there is no way to create a program that just sends a message and ends: the program waits forever even if you run through a pipe. __A more simple version to make automatic notifications from a machine would be desirable.__
Line 131: Line 151:
 ### END INIT INFO ### END INIT INFO
  
-TELEGRAM_BIN="/usr/local/bin/telegram-cli"+TELEGRAM_BIN="/usr/local/share/telegram/telegram-cli"
 TELEGRAM_PORT=1234 TELEGRAM_PORT=1234
-TELEGRAM_ARGS="-d -P $TELEGRAM_PORT"+TELEGRAM_ARGS="-p /home/telegramd/.telegram-cli -k /etc/telegram/tg-server.pub -d -P $TELEGRAM_PORT"
 PID_FILE=/var/run/telegram.pidfile PID_FILE=/var/run/telegram.pidfile
  
Line 191: Line 211:
 </code> </code>
  
-===== Step 7: create the system user telegramd ===== 
- 
-In order to run the telegram-daemon as root, you will need to create the user telegramd. I've opted 
-to create this user as a system user:  
- 
-<code> 
-# useradd -M --user-group --system --shell=/bin/false telegramd 
-</code> 
- 
- 
-**And give permissions into /etc/telegram:** 
- 
-<code> 
-chown telegramd:telegramd /etc/telegram/* 
-</code> 
  
 ===== Step 8: install the telegram-msg program ===== ===== Step 8: install the telegram-msg program =====
linux/telegram.1435787066.txt.gz · Last modified: 2022/12/02 22:02 (external edit)