There are two ways to authenticate to GitHub: your personal account and the repositories that are often linked to it. To work with them correctly, you need to authenticate to the server via two possible services: SSH keys and API token. This article is devoted to understanding how to use a repository after authenticating using the methods described earlier.
Let's run through briefly the pros and cons of the two methods and choose which of the two methods is convenient for you:
- API: it is necessary to enter the token every time, as it is not saved in the config for security reasons. And also it is necessary to define the place of its safe storage. However, convenient integration into own services and applications, mainly used for work between software;
- SSH: stored on the user's machine and does not need input, but is requested from the user's folder via ssh-agent. Convenient to store and use, when working with repositories.
GitHub API authentication
Use HTTPS authentication via GitHub API, password authentication has been disabled since 2021. On the top right find the user icon and select Settings, then in the left menu at the very bottom find Developer settings.
Following the diagram above, choose to create a classic token and wait for the page to load:
Specify the number of days the token will be valid, as well as define possible functions of the key. Then click on the button to create the key!
Copy your key and type the command, replacing the login and repository name:
git add .
git commit
git remote add origin https://github.com/your-login/your-repo.git
git push origin main
We can see from the logs that the upload was successful and now we can move on to the repository itself:
GitHub SSH authentication
The process is as follows: the user creates a pair of encryption keys on his side: a public key and a private key. The first one is added to the Github account, the second one is stored on the user's machine and allows decrypting the information encrypted with this first, public key. When a request to the server is made, the public keys in the account and on the sender's machine are checked, confirmed by the private key, and then access to the repositories is granted.
Let's create the keys and display them on the screen:
cat /home/your-linux-user/.ssh/id_rsa.pub
If you don't have sufficient resources than you can perform actions on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.
It will take some time to deploy server capacity. After that you can connect in any of the convenient ways.
Screenshot №7 — Show key
After copying the key, go to the GitHub site and select the user icon in the top right corner. Then find the Settings button and click on it. In the window that opens, select SSH and GPG on the left.
Click the New SSH key button and enter your key and a name for it in the field that opens. Note that it is the public key that can be distributed and specified in services, but the private key must remain on the machine. If intruders get access to it, they will also get access to your repositories.
After that you need to confirm with your account password that you are the one making the changes. After that the key will be available in your account:
Let's turn to the client device and enter the following command in the working directory with the files that you want to put in the repository: If you can access it, your repositories will be accessed too.
git add .
git commit
git remote add origin git@github.com:an1ik/koldek.git
git push origin main
There are two ways to authenticate to GitHub to interact with repositories and personal accounts: SSH keys and API tokens. Each of these methods has its advantages and disadvantages, choose the most convenient and secure method depending on your needs.
Conclusion
Extended file attributes in Linux provide a powerful mechanism for managing file behavior beyond standard permissions. With flags such as immutable (-i) or append-only (+a), administrators can significantly strengthen system security, protect logs from tampering, and prevent accidental deletion of critical files. These attributes work at a lower level than traditional rwx rights, ensuring more granular control. Proper use of extended attributes can serve as an additional security layer, especially in cases when user accounts are compromised.
By understanding and applying these attributes correctly, system administrators can improve data integrity, harden access control, and reduce risks of unauthorized file changes.
FAQ
- Q1: What are extended file attributes in Linux?
Extended attributes are low-level file properties (flags) that define behavior rules beyond standard permissions, such as preventing deletion or forcing append-only mode. - Q2: How do extended attributes differ from rwx permissions?
Standard permissions (rwx) control access levels for users, groups, and others. Extended attributes override this model by applying global restrictions that even root must respect. - Q3: How can I check attributes of a file?
Use the command:
lsattr filename
It will display all active attributes for the given file. - Q4: Can root bypass extended attributes?
Root cannot directly modify or delete files with +i or +a flags set. However, root can remove these attributes with chattr -i or chattr -a, after which normal operations become possible. - Q5: When should I use the immutable attribute?
Use +i when you need to fully protect important files from deletion or modification, for example, critical configuration files or security logs. - Q6: Do all Linux file systems support extended attributes?
No, support depends on the file system type. ext2, ext3, and ext4 support them, but not all file systems implement the same attribute set.