Installing Wine
Make sure you have extra repositories enabled.
In a terminal, type:
sudo aptitude update
sudo aptitude install wine
Using Wine
A bit about Wine... I don't know how it works, but it does seem to work with a lot of simple Windows programs. I'll show you how I get Filezilla to work in Linux, as an example.
I download the setup.exe file for Filezilla. When I double-click on it, Wine will try to open the file. Then, the installer appears, just as if I were using Windows. Instead of installing Filezilla to
C:\Program Files\Filezilla\
, I'm going to override the default installation location and install it to
z:\home\username\.wine\drive_c\Program Files\Filezilla
. For some reason,
z:\
is what Wine calls my Ubuntu partition.
Then, I set up a launcher (on the panel or in the menu) for the command
wine "z:\home\username\.wine\drive_c\Program Files\Filezilla\Filezilla.exe"
That's it. Now when I click on that launcher, Filezilla will load up.
Beyond Wine
As I said before, Wine seems to work with some simple Windows programs. For other Windows programs (particularly those that require Windows XP or 2000), you may need Crossover Office (this is not cost-free). If you're into gaming, you may need Cedega (also not cost-free). Other solutions include dual-booting, using two computers and a KVM switch, installing Windows in a VMWare session, or (God forbid) actually using a native Linux program.
see:-http://www.psychocats.net/ubuntu/wine
Friday, July 11, 2008
Ubuntu: Sending command line mail
I needed to send email from the command line, specifically for cron jobs, and there are many programs which can do this. I'm going to use the gnu mailutils package so first off let's install the mailutils package:
# apt-get install mailutils
This will add a few extra packages, then bring us up into an exim4 configuration screen. My systems are behind a dsl router, and I'm not going to route the mail through any relay host, I just want everything sent direct (for some sendmail agents this might cause problems, but you'll have to look at your logfiles). In the exim4 config screen I pick "internet site... mail is sent and receieved directly using SMTP". On edgy you might have to answer a few more questions, but I had to run a dpkg-reconfigure.
At this point we have exim4 listening on port 25 and I don't need that, so I need to stop the daemon and remove the startup links:
# /etc/init.d/exim4 stop
# update-rc.d -f exim4 remove
The update-rc.d command removes inits startup/shutdown links, but unfortunately if the exim4 packages get updated the links will be back so we need to run that command again.
Now lets try sending a test mail:
# echo testing | mail -s Bla myemail@somewhere.com
and take a look at /var/log/exim4/mainlog. You should be good to go!
Tested under dapper and edgy.
Comments
An easiest way would have been to install the ssmtp package before mailutils. No big exim package would have been installed then
# apt-get install mailutils
This will add a few extra packages, then bring us up into an exim4 configuration screen. My systems are behind a dsl router, and I'm not going to route the mail through any relay host, I just want everything sent direct (for some sendmail agents this might cause problems, but you'll have to look at your logfiles). In the exim4 config screen I pick "internet site... mail is sent and receieved directly using SMTP". On edgy you might have to answer a few more questions, but I had to run a dpkg-reconfigure.
At this point we have exim4 listening on port 25 and I don't need that, so I need to stop the daemon and remove the startup links:
# /etc/init.d/exim4 stop
# update-rc.d -f exim4 remove
The update-rc.d command removes inits startup/shutdown links, but unfortunately if the exim4 packages get updated the links will be back so we need to run that command again.
Now lets try sending a test mail:
# echo testing | mail -s Bla myemail@somewhere.com
and take a look at /var/log/exim4/mainlog. You should be good to go!
Tested under dapper and edgy.
Comments
An easiest way would have been to install the ssmtp package before mailutils. No big exim package would have been installed then
Wednesday, July 9, 2008
immutable files
immutable files
immutable attribute. if this is set,even root cannot delete the file until the attribute is unset.
use lsattr command to see whether immutable flag is set for a file or a directory
to make a file immutable use chattr command with -i flag
ex:- touch keep.me
chattr +i keep.me
lsattr keep.me
rm -f keep.me
cannot remove keep.me operation not permitted
chattr -i keep.me
rm -f keep.me
changing immutable flag requires root authority.making files immutable is often done as part of a security / intrusion detection effort. see man capabilities for more information
immutable attribute. if this is set,even root cannot delete the file until the attribute is unset.
use lsattr command to see whether immutable flag is set for a file or a directory
to make a file immutable use chattr command with -i flag
ex:- touch keep.me
chattr +i keep.me
lsattr keep.me
rm -f keep.me
cannot remove keep.me operation not permitted
chattr -i keep.me
rm -f keep.me
changing immutable flag requires root authority.making files immutable is often done as part of a security / intrusion detection effort. see man capabilities for more information
restricted shell
this is what i have read in the book ubuntu linux unleashed,
if you have a desire to severly restrict what a user can do, you can provide him with a restricted shell. to run a restricted bash shell, you would use the -r option
ex:- bash -r
then try to do something that you could do as a regular user, such as ls -a,
you will then see
bash: ls: no such file or directory
now my question is suppose i have my shell restricted, how to make it back un restricted ?
stachu dozzie
You can't. But you can search for a program, which can execute other programs. If you can't find out the rest, then you don't deserve unrestricted shell.
Lew pitcher
Assuming that you started the restricted shell from within the shell
bash -r
then all you have to do is exit to get back to your original shell
pk
I guess that if you'd be able to do that, then it would not be a "restricted" shell anymore.
However, according to the man page, if you are able to run a shell script using a command that does not contain "/", then the shell that runs that script is unrestricted. This can probably be exploited to somehow "escape" from the restrictions.
If you don't use the restricted shell as a login shell, just type "exit" to get back to the parent (unrestricted) shell.(btw, "ls -a" works fine for me even in a restricted shell)
pk
pk wrote:
>> now my question is suppose i have my shell restricted, how to make it
>> back un restricted ?
> I guess that if you'd be able to do that, then it would not be
> a "restricted" shell anymore.
Ok, it's actually very easy. Just edit your .bashrc or .bash_profile, and put "/bin/bash" in it. Logout, login, and you have an unrestricted shell. It's that simple. I suppose that, if the administrator wants to protect against that, he'll have to assign rbash with --noprofile and/or --norc as the user's shell.
Maxwell lol
There are ways to escape from sandboxes. the restricted shell is the
easiest to escape from.
For instance, start vi, and then execute a new shell from inside.
Mr C
If you changed your own shell to restricted, and have no access to another account in which to become root, you'll have to boot from a livecd / rescue CD to change it back. Since the restricted shell prevents you from specifing any command with a / in the pathname, and you can't change your PATH, you are stuck.
simon apnic
I don't advise you to use restricted bash shells..There are better choices like chroot, jail shells and others.And definitely you shouldn't do it to yourself, especially if you're using the root account (which many security experts don't recommend).
if you have a desire to severly restrict what a user can do, you can provide him with a restricted shell. to run a restricted bash shell, you would use the -r option
ex:- bash -r
then try to do something that you could do as a regular user, such as ls -a,
you will then see
bash: ls: no such file or directory
now my question is suppose i have my shell restricted, how to make it back un restricted ?
stachu dozzie
You can't. But you can search for a program, which can execute other programs. If you can't find out the rest, then you don't deserve unrestricted shell.
Lew pitcher
Assuming that you started the restricted shell from within the shell
bash -r
then all you have to do is exit to get back to your original shell
pk
I guess that if you'd be able to do that, then it would not be a "restricted" shell anymore.
However, according to the man page, if you are able to run a shell script using a command that does not contain "/", then the shell that runs that script is unrestricted. This can probably be exploited to somehow "escape" from the restrictions.
If you don't use the restricted shell as a login shell, just type "exit" to get back to the parent (unrestricted) shell.(btw, "ls -a" works fine for me even in a restricted shell)
pk
pk wrote:
>> now my question is suppose i have my shell restricted, how to make it
>> back un restricted ?
> I guess that if you'd be able to do that, then it would not be
> a "restricted" shell anymore.
Ok, it's actually very easy. Just edit your .bashrc or .bash_profile, and put "/bin/bash" in it. Logout, login, and you have an unrestricted shell. It's that simple. I suppose that, if the administrator wants to protect against that, he'll have to assign rbash with --noprofile and/or --norc as the user's shell.
Maxwell lol
There are ways to escape from sandboxes. the restricted shell is the
easiest to escape from.
For instance, start vi, and then execute a new shell from inside.
Mr C
If you changed your own shell to restricted, and have no access to another account in which to become root, you'll have to boot from a livecd / rescue CD to change it back. Since the restricted shell prevents you from specifing any command with a / in the pathname, and you can't change your PATH, you are stuck.
simon apnic
I don't advise you to use restricted bash shells..There are better choices like chroot, jail shells and others.And definitely you shouldn't do it to yourself, especially if you're using the root account (which many security experts don't recommend).
netcat
1)Port Scanning
netcat can also be used for port scanning (with zero-I/O option).
Code:
nc -v -z www.kernel.org 80 21
# or with port ranges
nc -v -z www.kernel.org 21-23
2. Remote Terminal
This example shows how to connect to a remote shell without using telnet or ssh. The terminal server which runs on:
Code:
nc -l -p 4000 -e /bin/sh
and the client :
Code:
nc 4000
3) File Transfer
Lets say you want to transfer a big zip file from machine A to machine B but neither one has FTP, and using email or IM is out of the question due to file size, or other restrictions. What do you do? You can use netcat as a makeshift file transfer software.
On machine B do the following, where 1337 is some unused port on which you want to send the file:
nc -lp 1337 > file.zipAssuming that the IP of machine B is 10.48.2.40 go to machine A and do:
nc -w 1 10.48.2.40 1337 < file.zip Thats it. The file will be magically transfered over the network socket.
4)Chat Server
Have you even needed an improvised one-on-one chat? Netcat can do that too. You simply start listening to connections on some port like this:
nc -lp 1337 Then on another machine simply connect to that port:
nc 10.48.2.40 1337 Now start typing on either machine. When you press enter, the line will immediately show up on the other machine.
OR
nc -l -n -v -p 555
on remote machine nc xxx.xxx.xxx.xxx [PORT]
5)Telnet Server
Nectat can also be used to set up a telnet server in a matter of seconds. You can specify the shell (or for that matter any executable) you want netcat to run at a successful connection with the -e parameter:
nc -lp 1337 -e /bin/bash On windows you can use:
nc -lp 1337 -e cmd.exeThen on a client machine simply connect to port 1337 and you will get full access to the shell, with the permissions of the user who ran nc on the server.
6 Web Server
I think this is my favorite trick. Did you ever need to set up simple makeshift webserver that would serve a single page? I know I did. In the past when my web server at work melted down, I set up laptop with this simple script:
while true; do nc -l -p 80 -q 1 < error.html; done
The error.html page was just a very simple error message notifying our users about the outage, and giving them an estimate of when it would be fixed. It took me 3 minutes to set up, and probably saved us many angry support calls.
source:- http://www.terminally-incoherent.com/blog/2007/08/07/few-useful-netcat-tricks/
netcat can also be used for port scanning (with zero-I/O option).
Code:
nc -v -z www.kernel.org 80 21
# or with port ranges
nc -v -z www.kernel.org 21-23
2. Remote Terminal
This example shows how to connect to a remote shell without using telnet or ssh. The terminal server which runs on
Code:
nc -l -p 4000 -e /bin/sh
and the client :
Code:
nc
3) File Transfer
Lets say you want to transfer a big zip file from machine A to machine B but neither one has FTP, and using email or IM is out of the question due to file size, or other restrictions. What do you do? You can use netcat as a makeshift file transfer software.
On machine B do the following, where 1337 is some unused port on which you want to send the file:
nc -lp 1337 > file.zipAssuming that the IP of machine B is 10.48.2.40 go to machine A and do:
nc -w 1 10.48.2.40 1337 < file.zip Thats it. The file will be magically transfered over the network socket.
4)Chat Server
Have you even needed an improvised one-on-one chat? Netcat can do that too. You simply start listening to connections on some port like this:
nc -lp 1337 Then on another machine simply connect to that port:
nc 10.48.2.40 1337 Now start typing on either machine. When you press enter, the line will immediately show up on the other machine.
OR
nc -l -n -v -p 555
on remote machine nc xxx.xxx.xxx.xxx [PORT]
5)Telnet Server
Nectat can also be used to set up a telnet server in a matter of seconds. You can specify the shell (or for that matter any executable) you want netcat to run at a successful connection with the -e parameter:
nc -lp 1337 -e /bin/bash On windows you can use:
nc -lp 1337 -e cmd.exeThen on a client machine simply connect to port 1337 and you will get full access to the shell, with the permissions of the user who ran nc on the server.
6 Web Server
I think this is my favorite trick. Did you ever need to set up simple makeshift webserver that would serve a single page? I know I did. In the past when my web server at work melted down, I set up laptop with this simple script:
while true; do nc -l -p 80 -q 1 < error.html; done
The error.html page was just a very simple error message notifying our users about the outage, and giving them an estimate of when it would be fixed. It took me 3 minutes to set up, and probably saved us many angry support calls.
source:- http://www.terminally-incoherent.com/blog/2007/08/07/few-useful-netcat-tricks/
Sunday, July 6, 2008
/etc/network/interfaces
the following are some of the lines in my /etc/network/interfaces file
auto lo
iface lo inet loopback
iface eth0 inet static
can any one explain what these lines are and what is their purpose ?
iface i know it means interface
eth0 - ethernet card 0
inet means what ?
what is meant by loopback , auto lo ?
nixscripter
"loopback" refers to an internal loopback network - 127.0.0.0/8
Loopback is a virtual interface which simply sends the packets from the local computer to itself. Leave that auto, as some daemons use it to for networking tricks, particularly RPC.
jamesapnic
The inet means that the interface will be used for "Internet" networking, i.e. using TCP/IP. Static means that it has been supplied with a fixed address and that is not, for example, using DHCP.
tredegar
and if you type man interfaces in a terminal, you can read a lot more about what the text in that file means.
auto lo
iface lo inet loopback
iface eth0 inet static
can any one explain what these lines are and what is their purpose ?
iface i know it means interface
eth0 - ethernet card 0
inet means what ?
what is meant by loopback , auto lo ?
nixscripter
"loopback" refers to an internal loopback network - 127.0.0.0/8
Loopback is a virtual interface which simply sends the packets from the local computer to itself. Leave that auto, as some daemons use it to for networking tricks, particularly RPC.
jamesapnic
The inet means that the interface will be used for "Internet" networking, i.e. using TCP/IP. Static means that it has been supplied with a fixed address and that is not, for example, using DHCP.
tredegar
and if you type man interfaces in a terminal, you can read a lot more about what the text in that file means.
Wednesday, July 2, 2008
Subscribe to:
Posts (Atom)
