البرمجة

كيفية استخدام أمر Write في Linux

The error message you’re seeing indicates that there is a mismatch between the user IDs (UIDs) of the sender and receiver when using the write command. This command is designed to allow communication only between users with the same UID. This restriction is in place for security reasons.

To fix this issue, you can either log in as the same user on both terminals or use a different method to communicate with the other user, such as using the mesg command to control access to your terminal or using a messaging application like talk or write in conjunction with sudo to switch to the correct user before sending the message.

For example, if you want to send a message to user “lex” who is logged in on terminal “pts/5” and your username is “george”, you can use the following command:

sh
sudo -u lex write lex pts/5

This command will run the write command as the user “lex”, allowing you to communicate with them even if you are logged in with a different UID.

I hope this helps! Let me know if you have any other questions.

المزيد من المعلومات

بالتأكيد! عند استخدام أمر write في نظام Linux، يتوجب عليك أن تكون مسجلاً بنفس UID لتتمكن من التواصل مع مستخدم آخر. UID هو معرف فريد يُعطى لكل مستخدم في النظام، ويحدد الصلاحيات التي يمتلكها المستخدم.

تأكد من أنك تعرف UID الخاص بالمستخدم الذي تريد التواصل معه. يمكنك استخدام الأمر id لعرض معلومات عن UID الحالي و UID للمستخدم الآخر. على سبيل المثال، إذا أردت التحقق من UID الخاص بالمستخدم “lex”، يمكنك استخدام الأمر التالي:

sh
id lex

إذا كنت تريد الاتصال بالمستخدم “lex”، يجب عليك تسجيل الدخول باستخدام نفس UID الذي يستخدمه “lex”، أو يمكنك استخدام الأمر sudo كما ذكرت سابقًا لتنفيذ أمر write بصلاحيات المستخدم “lex”.

أيضًا، يُعد أمر write قديمًا وله بدائل حديثة مثل استخدام تطبيقات المحادثة مثل Slack أو Discord أو استخدام البريد الإلكتروني للتواصل مع المستخدمين الآخرين.

زر الذهاب إلى الأعلى