Sayfalar

28 Kasım 2016 Pazartesi

ubuntu rdesktop "ERROR: recv: Connection reset by peer" hatası

ubuntudan Widows makinalara bağlantıda bu tarz hatalar alınıyorsa
windowsta seçili olan sadece rdp'ye izin ver seçeneğini kaldırmanız gerekir.

ubuntu rdesktop "ERROR: recv: Connection reset by peer" hatası

winowsta
 Alt + x
Run
SystemPropertiesRemote.exe + ENTER
kaldırın "Allow connections only from computers running Remote Desktop with
Network Level Authentication (recommended).

  Linux^te
# rdesktop -z -k it  -u $MYUSER -z -g 1250x720 -p '$password' -d $MYDOMAIN  $HOSTNAME  -r sound:local
yada 

remmina desktop^ta giriş yapmak için  advance ayarlarında şu değişikliği yapmanız gerekebilir.

20 Ocak 2016 Çarşamba

Send mails from command line

Install the mailx command

On Ubuntu/Debian based systems the mailx command is available from 2 different packages -
1. heirloom-mailx
2. bsd-mailx
We shall be using the heirloom-mailx package because it has more features and options.
On CentOS/Fedora based systems, there is only one package named "mailx" which is the heirloom package.
To find out what mailx package is installed on your system, check the "man mailx" output and scroll down to the end and you should see some useful information.
# ubuntu/debian
$ sudo apt-get install heirloom-mailx

# fedora/centos
$ sudo yum install mailx

Using the mailx command

Once installed, the mailx command can be directly referenced with the name mail, so you just type in that in the command line.

1. Simple mail

Run the following command, and then mailx would wait for you to enter the message of the email. You can hit enter for new lines. When done typing the message, press Ctrl+D and mailx would display EOT.
After than mailx automatically delivers the email to the destination.
$ mail -s "This is the subject" someone@example.com
Hi someone
How are you
I am fine
Bye
EOT

2. Take message from a file

The message body of the email can be taken from a file as well.
$ mail -s "This is Subject" someone@example.com < /path/to/file



The message can also be piped using the echo command -
$ echo "This is message body" | mail -s "This is Subject" someone@example.com

3. Multiple recipients

To send the mail to multiple recipients, specify all the emails separated by a comma
$ echo "This is message body" | mail -s "This is Subject" someone@example.com,someone2@example.com

4. CC and BCC

The "-c" and "-b" options can be used to add CC and BCC addresses respectively.
$ echo "This is message body" | mail -s "This is Subject" -c ccuser@example.com someone@example.com

5. Specify From name and address

To specify a "FROM" name and address, use the "-r" option. The name should be followed by the address wrapped in "<>".
$ echo "This is message body" | mail -s "This is Subject" -r "Harry" someone@example.com

6. Specify "Reply-To" address

The reply to address is set with the internal option variable "replyto" using the "-S" option.
# replyto email
$ echo "This is message" | mail -s "Testing replyto" -S replyto="mark@gmail.com" someone@example.com

# replyto email with a name
$ echo "This is message" | mail -s "Testing replyto" -S replyto="Mark" someone@example.com

7. Attachments

Attachments can be added with the "-a" option.
$ echo "This is message body" | mail -s "This is Subject" -r "Harry" -a /path/to/file someone@example.com

8. Use external SMTP server

This is an exclusive feature, that you get only with heirloom mailx and not bsd mailx, or the mail command from gnu mailutils or the mutt command.
The mailx command can use an external smtp server to use to relay the message forward. The syntax is a bit lengthy but makes sense.
$ echo "This is the message body and contains the message" | mailx -v -r "someone@example.com" -s "This is the subject" -S smtp="mail.example.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="someone@example.com" -S smtp-auth-password="abc123" -S ssl-verify=ignore yourfriend@gmail.com
Here is a breakdown
$ echo "This is the message body and contains the message" | mailx -v \
> -r "someone@example.com" \
> -s "This is the subject" \
> -S smtp="mail.example.com:587" \
> -S smtp-use-starttls \
> -S smtp-auth=login \
> -S smtp-auth-user="someone@example.com" \
> -S smtp-auth-password="abc123" \
> -S ssl-verify=ignore \
> yourfriend@gmail.com
You can use the gmail smtp servers and send emails via your gmail account. That is so cool!

9. Verbose - watch smtp communication

When using external smtp servers, you can choose to watch the entire smtp communication that is done in the background. This is useful specially when testing or debugging smtp servers.
$ echo "This is the message body and contains the message from heirloom mailx" | mailx -v -s "This is the subject" -S smtp="smtp.gmail.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="mygmail@gmail.com" -S smtp-auth-password="mypassword" -S ssl-verify=ignore someone@example.com
Resolving host smtp.gmail.com . . . done.
Connecting to 74.125.68.109:587 . . . connected.
220 mx.google.com ESMTP je4sm32812877pbd.94 - gsmtp
>>> EHLO enlightened
250-mx.google.com at your service, [122.163.43.21]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO enlightened
250-mx.google.com at your service, [122.163.43.21]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
>>> AUTH LOGIN
334 VXNlcm5hbWU6
>>> Ymx1ZWJ1enppdEBnbWFpbC5jb20=
334 UGFzc3dvcmQ6
>>> KnJpc2hhYmgzKg==
235 2.7.0 Accepted
>>> MAIL FROM:
250 2.1.0 OK je4sm32812877pbd.94 - gsmtp
>>> RCPT TO:
250 2.1.5 OK je4sm32812877pbd.94 - gsmtp
>>> DATA
354  Go ahead je4sm32812877pbd.94 - gsmtp
>>> .
250 2.0.0 OK 1417930703 je4sm32812877pbd.94 - gsmtp
>>> QUIT
221 2.0.0 closing connection je4sm32812877pbd.94 - gsmtp

Troubleshooting

In case the mails are not being delivered properly you need to check a few things. The first thing to check is that an smtp server (mta) is running locally. The netstat command can tell that
$ sudo netstat -ltnp | grep 25
[sudo] password for enlightened: 
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      2541/master     
tcp6       0      0 :::25                   :::*                    LISTEN      2541/master
If an stmp server like Postfix is running and still mails are not going, then try re-configuring Postfix for example. On Ubuntu/Debian systems, this can be done with the dpkg-reconfigure command
$ sudo dpkg-reconfigure postfix
Then retry, the mail command and it should work. If it still doesn't, try contacting your server provider.


Source: binarytides

5 Ocak 2016 Salı

Aix'de file sistem ve disk yönetimi



# cfgmgr



The disks will now be presented as shown below. Use the lspv command to view the disks:



# lspv

hdisk0         00c23bed42b3aefe                   rootvg         active

hdisk1         00c23bed42b3afff                   rootvg         active

hdisk2         00525c6a888e32cd                   None

hdisk3         00c23bed32883598                   None


What Type of Disk Is Present

In this example, the new disks come in as hdisk2 and hdisk3. New disks will not necessarily come in sequential order. This is particularly true if the disks use disk slots and you do not populate them one after the other. Notice that the new disks have not yet been assigned to a VG, so the third column states None. We can tell what sort of disk each is by querying the ODM using the lsdev command:



# lsdev -Cc disk

hdisk0 Available 04-08-00-3,0 16 Bit LVD SCSI Disk Drive

hdisk1 Available 04-08-00-4,0 16 Bit LVD SCSI Disk Drive

hdisk2 Available 04-08-00-5,0 16 Bit LVD SCSI Disk Drive

hdisk3 Available 04-08-00-8,0 16 Bit LVD SCSI Disk Drive



The new disks are SCSI disks as are the others.


Disk Sizes: How to Tell

Let's now determine the size of the disks. There are a few methods you can use to see the disk size. Let's look at the most common methods. First, we'll use the lsattr command, which returns device information on the system. The format of the command is this:



lsattr -El < device>



# lsattr -El hdisk2

PCM             PCM/friend/scsiscsd               Path Control Module

False

algorithm       fail_over                        Algorithm

True





size_in_mb     18200                             Size in Megabytes

False

unique_id       21080006CB0A0AST318305LC03IBMscsi Unique device identifier

False



The above lsattr output states that the disk is 18200 MB or 17.7 GB.



You can also use the undocumented command bootinfo. Though this is discouraged by IBM, it will return the usable amount of disk that can be used by the system after formatting. Here's the format of the command:



bootinfo -s

# bootinfo -s hdisk2

17357



The above output states we have a 17357 MB disk or 16.9 GB.



The best and recommended way to determine the size of a disk is to use the getconf command. The getconf will extract the systemwide variables from the kernel. Here's the format:



getconf DISK_SIZE

# getconf DISK_SIZE /dev/hdisk2

17357



In the above output, the getconf returns 17357MB or 16.9 GB.



We have used three commands to get the disk sizes. Two of them agree on the size. Not bad, I guess. To get the correct disk size, use getconf, as this comes from the kernel, the heart of the AIX system.
Creating a Volume Group

For a disk to be used for storage, it needs to be added to an existing VG or a new VG. Let's first add it to a new VG called testvg. The format for the command I am now going to run is this:



mkvg -B -y



here, -B means it should be a big VG. It will be able to have up to 128 disks if required in the VG. The vg_name is the name you are going to call it, followed by a list of hdisks you wish to assign to the VG. Here is the command:



# mkvg -B -y testvg hdisk2

testvg



Viewing the current VGs on the system, we can see that it is present.



# lsvg

rootvg

holdvg

testvg



You can see that hdisk2 is now assigned to the VG testvg. Use the lspv command to confirm:



# lspv

hdisk0         00c23bed42b3aefe                   rootvg         active

hdisk1         00c23bed42b3afff                   rootvg        active

hdisk2         00525c6a888e32cd                   testvg         active

hdisk3         00c23bed32883598                   None



You can also query the disks contained in a VG by issuing the lsvg command:



# lsvg -p testvg

testvg:

PV_NAME           PV STATE         TOTAL PPs   FREE PPs   FREE DISTRIBUTION

hdisk2           active           542         542         109..108..108..108..109
Volume Group Maintenance

Let's now add another disk, hdisk3 to the volume group testvg. First, though, determine the disk size:



# getconf DISK_SIZE /dev/hdisk3

70006



It's 70 GB or thereabouts. Now, let's add the disk to the existing VG testvg, using the extendvg comamnd. The format for the command I am now going to run is this:



extendvg   



Here, vg_name is the name of the VG, followed by a list of hdisks you wish to add to the VG. Here's the command:



# extendvg testvg hdisk3



Now let's view the disks and to see what VG is assigned to them. The following output states that hdisk2 and hdisk3 are assigned to the VG testvg:



# lspv

hdisk0         00c23bed42b3aefe                   rootvg         active

hdisk1         00c23bed42b3afff                   rootvg         active

hdisk2         00525c6a888e32cd                   testvg         active

hdisk3         00c23bed32883598                   testvg         active



Now that we've added the extra disk, let's get the size of the VG. In the following output, we can determine the size of the VG by locating the TOTAL PP value (total number of physical partitions on the disks). In this example, it's 87328 MB or 85.2 GB.



# lsvg testvg

VOLUME GROUP:       testvg                   VG IDENTIFIER: 00c23bed00004c00000

0013805b7d417

VG STATE:               active             PP SIZE:       32 megabyte(s)

VG PERMISSION:     read/write               TOTAL PPs:     2729 (87328 megabytes







To calculate the size of the VG, you can also use the following formula, using the values from the above lsvg command:



PP SIZE * TOTAL PP



Like so:

# expr 2729 \* 32

87328



To remove a disk from a VG, first be sure you have removed all data from that disk. You will be warned if there is data on the disk and you try to remove it, which is a good reminder in my books.



Typically, you would unmount any file systems and remove them using the rmfs command on the disk you want to remove. Alternatively, you could use migratepv to literally migrate the data from that disk to another disk contained in that VG. Let's assume all data has been removed from that disk. To remove a hdisk from a VG, use the reducevg command. The format for this example is this:



reducevg



Here, the vg_name is the name of the VG, followed by a list of hdisks you wish to remove from the VG. Here's the command:



# reducevg testvg hdisk2



The VG testvg now has only hdisk3 assigned to it:



# lsvg -p testvg

testvg:

PV_NAME           PV STATE         TOTAL PPs  FREE PPs   FREE DISTRIBUTION

hdisk3           active           2187       1866       438..116..437..437..438
Dynamically Changing File System Sizes

In our VG, we also now have some data. A file system called /data_fs is present with a size of 8 GB. The file system has data residing in it; it's 71% used and has only 2.38 GB of free space left:



# df -g

Filesystem   GB blocks     Free %Used   Iused %Iused Mounted on

….

….

/dev/fslv00       8.00     2.38   71%       27     1% /data_fs



That file is getting pretty full, so let's now increase that file system to 12G. The format for increasing or decreasing a file system in GB or MB increments in this example is this:



chfs -a size= /file_filesystem



So to increase the file system from 8 GB to 12 GB, I could use this:



# chfs -a size=12G /data_fs

Filesystem size changed to 25165824



Looking at the newly change file system size, we see the change:



# df -g| grep data_fs

Filesystem   GB blocks     Free %Used   Iused %Iused Mounted on



...

/dev/fslv00       12.00     6.38   47%       27     1% /data_fs



Now suppose we wanted to reduce the file system size by 2G, so the new size would be 10G. We could use this:



# chfs -a size=10G /data_fs

Filesystem size changed to 20971520



Let's view the new file system size:



# df -g| grep data_fs

Filesystem   GB blocks     Free %Used   Iused %Iused Mounted on

..

...

/dev/fslv00       10.00     4.38   57%       27     1% /data_fs


 Resource: http://www.mcpressonline.com/unix-/-aix/managing-disks-and-file-systems-on-aix.html