20061018
From Wsms
previous next
Go To:Linux Class Notes
Contents |
[edit]
Sending files with ssh
When you send a configuration file, you can deeply modify the system. There must exist procedures to do the best to ensure the safety of the system.
Now, we are going to edit the file /etc/ssh/ssd_config
Now, nobody can login to the server as a root user
- Make a copy of the line related to permit root login.
- Don't allow root login
- close and save the file
- type "service sshd restart" in the command line
They have to connect as another user, and then use the su to get to the root user.
[edit]
some useful tools
[edit]VI editor
Joe gives us a copy of a reference card to vi.
Outside this facility, we have to use the rop.ncc.sdcc.net domain name to get connected to our server.
We begin to work with vi in command and editing mode.
Here is a question: Why do we have to learn and get skills in vi or any other editor under linux?
Here is an interesting 'vi' manual site: http://www.eng.hawaii.edu/Tutor/vi.html
There are dozens of editors in Unix. vi is one of the most popular
[edit]GREP command
To search through files from the command line.
Example:
Being in the /etc/ssh folder, type
grep Root *
You will obtain the following output:
sshd_config:PermitRootLogin no sshd_config:# "PermitRootLogin without-password". If you just want the PAM....
It is used to filter data in a text source.
It can also be used to search for a string that maybe contain one of many files on a file system.
For further information, you can look to: http://pegasus.rutgers.edu/~elflord/unix/grep.html[edit]ps command
To view the current processes.
[edit]printenv
Used to see the environmet variables. It will show all the environmental variables asociated with the current user.
To see the content of one environmental variable, it is possible to use the command echo like this:
echo $PATH
echo $HISTZISE
There are 4 files asociated with the environmental variables:
This two apply to all users if they exists. Anything that is intere will be common for all users.
- /etc/profile
- /etc/bashrc
There might not be anything in those files. Those files are in each of anyone home directory. Those files exist to make the users be able to "localy" modify things that are set in the other two files that are common for all users in the /etc directory.
- ~/.bash_profile
- ~/.bashrc
One of these files is processed anytime you enter interactively and the other is proccessed anytime you enter using a shell.
When you enter via another shell (like using su or running a script), only one of those files load and set the environmental varialbles.
[edit]export
Once you change an enviromental variable's value, you must export it, so you affect the value the system has for you.
Example:
- open the .bash_profile with vi
- add this two lines:
With that change made, you can open a new terminal window and see that the value has changed by typing echo $HISTSIZE, that will be set to 2000 for that user.
- HISTSIZE=2000
- export HISTSIZE
This command is built in in bash.
[edit]Questions
[edit]1. How do I fix something I screwed up using the .bash_profile file? (copy command)
Answer: There is a folder called /etc/skel, wich was copied when you were aded as a user. When you screw one of those files up, you can go to that directory and copy that file again in the way it was made when your account was created adding you as a user.
The solution is the copy command
- cp /etc/skel/.bash_profile .
